| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
|
|
|
|
|
|
|
|
|
|
| |
function lookup fails, and if that fails, retrieve the special
operator binding.
(fboundp): Report t if there is a global macro binding.
* txr.1: Use "global" rather than "toplevel". Added note that
the fun operator doesn't see macro bindings. Documented that
symbol-function and fboundp see global macro bindings,
and that symbol-function can retrieve a special operator binding.
|
|
|
|
|
|
| |
(eval_init): Registered as intrinsics.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
* eval.h: Declare existing lambda_s extern variable.
* lib.c (obj_print, obj_pprint): print (lambda sym ...)
as (lambda (. sym) ...) and (lambda sym) as (lambda (. sym)).
* txr.1: document it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
here if the env parameter is nil. The low level environment
lookup functions already handle nil.
(do_eval): Do not type check the env argument for the ENV type.
(expand_forms, expand): No need to default a missing menv to a
blank environment; just use nil.
(macro_form_p): Take menv parameter and switch to lookup_mac
from gethash.
(macroexpand_1, macroexpand): Use the environment parameter
by using lookup_mac rather than gethash.
(eval_init): Fix registration of macro_form_p to reflect new
optional argument.
* txr.1: Documented optional environment parameters in macro-form-p,
macroexpand-1 and macroexpand.
Documented macrolet.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
All predefined globals become special.
* eval.c (special, with_saved_vars_s): New global variables.
(mark_special, special_p): New functions.
(bindings_helper): Takes new argument, include_specials.
Now processes the special colon syntax for denoting special variables,
setting up their values, taking care to observe whether the
binding is parallel or sequential.
(op_let, op_for): Pass new argument to bindings_helper.
(op_each): Pass new argument to bindings_helper with a value of it,
and deal with the colon annotations that emerge in the bindings.
(op_defvar, regvar): Mark symbol as special.
(op_with_saved_vars): New static function.
(expand_vars): Takes new argument, returns a cons. Detects special
variables among the vars and produces the colon syntax.
(expand_catch_clause): Bugfix: this was using expand_vars on
a parameter list. Now properly uses expand_params.
(expand_save_specials): New static function.
(expand): For the operators that are binding constructs, handle
the new form of expand_vars which returns information about
special variables. If specials occur, then generate the
with-saved-vars form around the expansion which will save and restore
their values. The expansion of vars done by expand_vars, together
with the run-time actions of bindings_helper, do the rest.
Speaking of which, the new with-saved-vars operator form is now
expanded here too.
(eval_init): Protect new variables special and with_saved_vars_s.
Initialize special with new hash table. Store new interned
symbol in with_saved_vars_s. Register op_with_save_vars in op_table.
* txr.1: Documented specials.
|
|
|
|
|
|
|
| |
functions.
(eval_init): Registered new functions.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
opening of files, prior to directives that actually need data.
The documentation basically lied that this is the case: namely,
the text "A file isn't opened until the query demands material from
that file, and then the contents are read on demand, not all at
once." This is now a fact.
* match.c (non_matching_directive_table): New global variable.
(open_data_source): New static function. Contains an almost
verbatim migration of the source-opening logic that used
to be in match_files. The useless assignment to c->nil is gone,
and c->data == t is explicitly tested for. Instead of assuming
that only the @(next) directive does not need to have a data source
open, the table of non-matching directives is consulted. Opening
the data source is now skipped for numerous directives.
(match_files): Call open_data_source within the loop. This
means that even after processing numerous non-matching directives,
we will still correctly set up the data lazy list.
(dir_tables_init): Initialize non_matching_directive_table,
protect from GC and populate with numerous directives.
* txr.1: Improved documentation for @(next :args), and removed
a description of the hack that a single @(next) at the top of the
query suppressed the opening of the data source.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(eval_init): Register env and env_hash functions. Register prog_args
and prog_args_full as *args* and *full-args*.
* lib.c (timegm_hack): Invalidate env_list, after mucking with
the environment via setenv and unsetenv.
* txr.c (prog_args_full, prog_args): New global variables.
(txr_main): Command-line processing converted to use TXR's
library. Populates prog_args_full and prog_args.
* txr.h (prog_args_full, prog_args): Declared.
* txr.1: Documented *args*, *full-args*, env and env-hash.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Change registration for open_file, open_tail
and open_command.
* stream.c (open_file, open_tail, open_command): mode_str argument
defaulted.
* txr.1: Updated.
|
|
|
|
|
|
|
|
| |
seek_to_end_p argument being ignored, with the
behavior being no initial seek to the end.
* txr.1: Clarified the behavior of the seek-to-end-p
option.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* txr.c (version): Bumped.
* txr.1: Bumped version and set date.
* configure (txr_ver): Bumped.
* RELNOTES, txr.vim, dep.mk: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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*.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
* hash.c (hash_update_1): New function.
* hash.h (hash_update_1): Declared.
* txr.1: Documented hash-update-1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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!
|
|
|
|
|
|
|
| |
(hash_ops): New functions registered in table of operations.
* txr.1: Documentation for equal function updated to explain
how two hashes are equal.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
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.
|
| |
|