| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
zero, return the other operand.
(lcm): New function.
* eval.c (eval_init): Retarget registration of gcd to
variable argument gcdv function. Register lcm.
* lib.c (gcdv, lcmv): New functions.
* lib.h (gcdv, lcm, lcmv): Declared.
* txr.1: Re-document gcd with coverage of lcm.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (gt_f, lt_f): Global variables removed.
(greater_f): New variable.
(greater): New function.
(find_max, pos_max): Use greater_f as default for testfun,
rather than gt_f.
(find_min, pos_min): Use less_f as default for testfun,
rather than lt_f.
(obj_init): Remove references to gt_f and lt_f.
GC-protect and initialize greater_f.
* lib.h (greater_f): Declared.
(gt_f, lt_f): Declarations removed.
* txr.1: Documented greater, and use of less and greater
in pos-min, pos-max, find-min and find-max.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(eval_init): Register less as intrinsic. Retarget merge intrinsic to
merge_wrap for proper argument defaulting which is missing from merge,
and which we don't want to introduce there since internal calls
to merge don't erquire it. Change registration of sort so it has
only one required argument, not two.
* lib.c (less_f): New global variable.
(less_tab): New static array.
(less_tab_init): New static function.
(less): New function.
(sort): Default lessfun argument to the less function.
(obj_init): GC-protect the less_f variable.
Initialize it with a function object made from the less function.
(init): Call less_tab_init.
* lib.h (enum type): New enumeration member MAX_TYPE, an alias
for the largest type.
(less_f, less): Declared.
* txr.1: Documented new less function, and that the lessfun
argument in sort and merge is optional, defaulting to less.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
intrinsics.
* lib.c (chr_isblank, chr_isunisp): New functions.
* lib.h (chr_isblank, chr_isunisp): Declared.
* regex.h (spaces): Declaration for existing variable added.
* txr.1: Documented chr-isblank and chr-isunisp.
* genvim.txr: Add missing sysif.c.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the eval and stream modules.
* Makefile (OBJS): Add sysif.o.
* dep.mk: Regenerated.
* eval.c (errno_wrap, daemon_wrap, exit_wrap, usleep_wrap, getpid_wrap,
getppid_wrap, env_hash): Functions moved to sysif.c and changed
to static functions.
(eval_init): Registrations of functions moved to sysif.c.
* lib.c (init): Call sysif_init.
* stream.c (w_stat, statf, mkdir_wrap, chdir_wrap, getcwd_wrap,
makedev_wrap, minor_wrap, major_wrap, mknod_wrap): Functions
moved to sysif.c and become static functions.
(stream_init): Registration of stat moved to sysif.c.
(open_files, open_files_star): Bugfix: no longer erroneously included
in #ifdef HAVE_UNISTD_H block.
* stream.h (mkdir_wrap, chdir_wrap, getcwd_wrap, makedev_wrap,
minor_wrap, major_wrap, mknod_wrap, symlink_wrap, link_wrap,
readlink_wrap): Declarations removed.
* sysif.c: New file.
* sysif.h: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
relies on lazy_str_get_trailing_list and the behavior
of that function changed because (split-str "" any-separator)
changed from returning nil to returning the empty string.
The resulting behavior change of lazy_str_get_trailing_list was later
described in the documentation, thereby codifying it.
This patch changes the lazy_str_get_trailing_list behavior,
which is poor, and causes infinite looping. We do not want
an extra empty string prepended, because it looks like
a spurious line.
* lib.c (lazy_str_get_trailing_list): if split_str produces
a the list (""), then just return the unmaterialized list from
the lazy string without prepending that one-element list to it.
* txr.1: Updated documentation for lazy-str-get-trailing-list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
rather than the list-based notation for derivative-based
regexes, and an encapsulated COBJ for NFA-based regexes.
* lib.c (compiled_regex_s): Variable removed.
(obj_init): Initialization of compiled_regex_s removed.
* lib.h (compiled_regex_s): Declaration removed.
* regex.c (struct regex, regex_t): New type.
(regex_destroy): Object is now a regex_t, not nfa_t.
(regex_mark): New function.
(regex_obj_ops): Register regex_mark operation.
(reg_nullable, reg_derivative): Remove cases that handles
compiled_regex_s.
(regex_compile): Output of dv_compile_regex becomes
a cobj nwo. Output of nfa_compile_regex must be
embedded in regex_t structure.
(regexp): Drop the check for compiles_regex_s.
(regex_nfa): Function removed.
(regex_run, regex_machine_init): Use cobj_handle to retrieve regex_t *
pointer and dispatch appropriate code based on regex->kind.
|
|
|
|
| |
a function that returns t, as documented.
|
|
|
|
|
| |
lacking the semantics of returning the last value,
or the first true value, respectively.
|
|
|
|
|
|
|
|
|
| |
Returns minimum supported emulation.
* lib.h (compat_fixup): Declaration fixed.
* txr.c (compat): Replace hard-coded min version
by return value of compat_fixup.
|
|
|
|
|
|
|
|
|
| |
* lib.c (partition_star_func): New static function.
(partition_star): New function.
* lib.h (partition_star): Declared.
* txr.1: Documented partition*.
|
|
|
|
|
|
|
|
|
| |
* lib.c (partition_func): New static function.
(partition): New function.
* lib.h (partition): Declared.
* txr.1: Documented partition.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(opt_gc_delta): New global variable.
(make_obj): Use opt_gc_delta rather than MALLOC_DELTA_THRESH.
(gc_set_delta, gc_wrap): New static functions.
(gc_late_init): New function.
* gc.h (gc_late_init): Declared.
* genvim.txr: scan gc.c also.
* lib.c (init): call gc_late_init.
* txr.1: Document new --gc-delta option and the functions
gc and gc-set-delta.
* txr.c (help): Help text for --gc-delta.
(txr_main): Parse --gc-delta option.
* txr.h (opt_gc_delta): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(obj_init): Change exception symbol names with underscores
to use friendly dashes instead.
(compat_fixup): New function.
* lib.h (compat_fixup): Declared.
* txr.1: Change occurrences of exception symbols from
underscores to dashes.
* txr.c (txr_main): Call compat_fixup when -C option
is processed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to account for new parameter.
* lib.c (syntax_error_s): New symbol_variable.
(obj_init): New symbol variable initialized.
* lib.h (syntax_error_s): Declared.
* parser.h (lisp_parse): Declaration updated.
* parser.l (lisp_parse): Takes third parameter.
* txr.1: Third parameter of read described.
* txr.c (txr_main): Pass colon_k to third parameter of lisp_parse
to obtain exception throwing behavior.
* unwind.c (uw_init): Register syntax-error as subtype of error.
|
|
|
|
|
|
|
|
|
|
|
|
| |
*flo-min*, *flo-max*, *flo-epsilon*, *pi* and *e*.
* genvim.txr: Include arith.c in scan for symbols.
* lib.c (init): arith_init() must now be called after eval_init().
* txr.1: Documented new variables..
* txr.vim: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
low level C pointers, while we execute code that can cons memory.
* lib.c (list_str): Protect the str argument.
(int_str): Likewise.
* regex.c (search_regex): protect the haystack string,
while using the h pointer to its data, since regex_run
can use the derivative-based engine which conses.
* stream.c (vformat_str): Protect str argument, since
put_char might conceivably cons.
(vformat): Protect fmtstr.
|
|
|
|
|
|
|
|
| |
* lib.c (uniq): New function.
* lib.h (uniq): Declared.
* txr.1: Documented uniq.
|
|
|
|
|
|
|
|
| |
* lib.c (nconcv): New function.
* lib.h (nconcv): Declared.
* txr.1: Documented nconc.
|
|
|
|
| |
argument so empty vectors and strings can be processed.
|
|
|
|
|
|
|
|
|
| |
* lib.c (partition_by_func): New static function.
(partition_by): New function.
* lib.h (partition_by): Declared.
* txr.1: Documented partition-by.
|
|
|
|
|
|
|
|
| |
in some contexts that require functions.
* lib.c (funcall, funcall1, funcall2, funcall3, funcall4):
check type(fun) before dereferencing to see whether there
are optional args.
|
|
|
|
|
|
|
|
| |
debug.h, eval.c, eval.h, filter.c, filter.h, gc.c, gc.h, hash.c,
hash.h, lib.c, lib.h, match.c, match.h, parser.h, parser.l, parser.y,
rand.c, rand.h, regex.c, regex.h, signal.c, signal.h, stream.c,
stream.h, syslog.c, syslog.h, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h: Synchronize license header with LICENSE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
executable, whether this is due to being required to use C99.
For instance, the Solaris environment requires compilation
using the C99 dialect if _XOPEN_SOURCE is set to 600 or higher.
* debug.c: When compiling as C99, we have to obey the special
C99 conventions for instantiating inline functions.
* hash.c: Likewise.
* lib.c: Likewise.
* parser.y: Likewise.
* unwind.c: Likewise.
|
|
|
|
|
|
|
|
|
| |
* lib.c (do_juxt): New static function.
(juxtv): New function.
* lib.h (juxtv): Declared.
* txr.1: Documented juxt.
|
|
|
|
|
|
| |
Hoist uselessly repeated c_str operation out of loop.
* txr.1: Document negative starting index for search-str.
|
|
|
|
|
|
|
|
|
|
|
| |
(eval_init): Register mapdo intrinsic.
* lib.c (mapdo): New function.
* lib.h (mapdo): Declared.
* txr.1: Documented mapdo. Documented zero-argument case
for mapcar, mapcar*, mappend and mappend*.
|
|
|
|
|
|
|
|
|
| |
* lib.c (lconsp, interpose): New functions.
(lazy_interpose_func, lazy_interpose): New static functions.
* lib.h (lconsp, interpose): Declared.
* txr.1: Documented lconsp and interpose.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
such as obtained by the where function.
* lib.c (replace_list, replace_str, replace_vec): Allow the
from argument to be a list of index positions, possibly empty.
* txr.1: Condensed syntactic descriptions under dwim operator.
Range Indexing section no longer says that the value nil
can be used as either endpoint of a range. This will not
work any longer since a "from" value of nil looks like an
empty list of indexes. Documented new behavior under
replace, and shortened documentation for replace-list,
replace-str and replace-vec.
|
|
|
|
| |
which are lists.
|
|
|
|
| |
* txr.1: document hash support for select and where.
|
|
|
|
|
|
|
|
|
|
|
|
| |
manipulate argument lists.
* eval.c (apply_frob_args): Rewrite to non-destructive
one-pass version.
(iapply): Likewise.
* lib.c (term): New function.
* lib.h (term): Declared.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
as intrinsics.
* lib.c (tok_where): New function.
* lib.h (tok_where): Declared.
* regex.c (range_regex): New function.
* regex.h (range_regex): Declared.
* txr.1: Documented tok-where and range-regex.
|
|
|
|
| |
trying to print cons function pointer as value.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
a non-list sequence.
(eval_init): Register transpose and zip as intrinsics.
* lib.c (curry_12_1_v): New static function.
(transpose, mapcar_listout): New functions.
(mapcar): Redefined in terms of mapcar_listout.
* lib.h (transpose, mapcar_listout): Declared.
* txr.1: Documented transpose and zip.
|
|
|
|
|
|
|
|
|
|
|
| |
collecting loops.
* lib.c (tuples_func, where, sel): Catch return value of
list_collect and update tail variable.
* match.c (do_txeval): Likewise.
* parser.y (expand_meta): Likewise for list_collect_nconc.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(eval_init): Use new list_f instead of func_n0v(identity).
Register multi as intrinsic. Register me_ap as ap macro.
* lib.c (list_f): New global variable.
(multi): New function.
(multi_sort): Use list_f in place of func_n0v(identity).
(obj_init): gc-protect and initialize list_f.
* lib.h (list_f, multi): Declared.
* txr.1: Documented multi and ap.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (member, member_if): New functions.
* lib.h (member, member_if): Declared.
* txr.1: Documented.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
| |
Removed dubious statement which clamps nargs to the number
of fixed parameters, breaking variadic calls.
Test case: (mapcar 'list '(1 2)) -> ((1) (2))
Note: generic_funcall is only used when non-function objects
are used as functions; variadic funcalls were not broken.
|
|
|
|
|
|
|
|
|
| |
* lib.c (tuples_func): New static function.
(tuples): New function.
* lib.h (tuples): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Clean up code which chooses rendering for characters.
Print C0 and C1 control characters, as well as D800-DFFF,
FFFE and FFFF and characters above FFFF using hex;
others are printed using the #\<char> notation.
* parser.y (char_from_name): map "pnul" to DC00.
* txr.1: Documented pnul, clarified character
printing rules, and added a cautionary note about
possible ambiguity in printing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
find_min and seqp as intrinsics.
* lib.c (gt_f, lt_f): New variables.
(to_seq): renamed to toseq.
(seqp): New function.
(minmax): New static function.
(replace_str, replace_vec): Follow to_seq renaming.
(find_max, find_min, pos_max, pos_min): New functions.
(obj_init): gc-protect and initialize gt_f and lt_f.
* lib.h (gt_f, lt_f): Declared.
(to_seq): Declaration updated to toseq.
(seqp, find_max, find_min, pos_max, pos_min): Declared.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
where and select.
* lib.c (generic_funcall): Support a sequence as an argument
to a sequence.
(where, sel): New functions.
* lib.h (where, sel): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to cmp_str. Add registrations for str_eq, str_lt,
str_gt, str_le, and str_lt.
* lib.c (string_cmp): Name changes to cmp_str, and the
function fixed so that it actually works.
The name change doesn't affect anyone because the function
was too broken to use due to the incorrect type dispatch.
(string_lt): Name changes to str_lt.
(str_eq, str_gt, str_le, str_ge): New functions.
* lib.h (string_cmp, string_lt): Declarations renamed.
(str_eq, str_gt, str_le, str_ge): New declarations.
* txr.1: Document string-cmp to cmp-str rename, that
string-lt is deprecated, and the new str<, str>,
str>=, str<= and str= functions.
|
|
|
|
|
|
| |
start argument.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
namely that empty strings and vectors are not nil.
The nullify function is introduced. It is also exposed to
users, as is the existing make_like function.
* eval.c (mapcarv, mappendv, lazy_mapcar, lazy_mapcarv):
Use nullify to handle non-list inputs correctly.
(eval_init): Registering make_like and nullify as intrinsics.
* lib.c (copy_list, to_seq, list_collect_nconc, list_collect_append,
reverse, lazy_appendv_func, lazy_appendv, ldiff, memq, memql,
memqual, remq, remql, remqual, remove_if, keep_if, rem_lazy_rec,
remq_lazy, remql_lazy, remqual_lazy, remove_if_lazy, keep_if_lazy,
countqual, countql, countq, count_if, some_satisfy, all_satisfy,
none_satisfy, do_chain, chainv, do_and, andv, do_or, orv,
cat_vec, assoc, assql, mapcar, mapcon, mappend, sort, multi_sort,
find, find_if, posqual, posql, posq, pos, pos_if, set_diff,
search): Use nullify for correctness. Some functions fixed
so return sequence matches type of input sequence.
(nullify): New function.
* lib.h (nullify): Declared.
* txr.1: Documented nullify and ake-like.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (search_list): New static function.
(search): New function.
* lib.h (search): New function declared.
* txr.1: Documented.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
it to be the cell, rather than the new value.
* eval.c (transform_op): Fix use of rplacd that uses return value.
(force): Likewise.
* lib.c (rplaca, rplacd): Return cons.
(rem_lazy_rec, obj_init): Fix use of rplacd that uses return value.
* txr.1: Documented.
|