summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* * arith.c (bit): New function.Kaz Kylheku2014-06-286-4/+110
| | | | | | | | | | * eval.c (eval_init): Register bit as intrinsic. * lib.h (bit): Declared. * mpi-patches/add-bitops (mp_bit): New function. * txr.1: Documented bit
* * mpi-patches/add-bitops (mp_and, mp_or, mp_xor, mp_shift): Plug memoryKaz Kylheku2014-06-282-38/+43
| | | | | | | leaks caused by wrongly initializing the temporary destination operand for mp2_comp with a size, which mp2_comp then clobbers by doing the same thing. Also plug memory leaks that happen in in out-of-memory return case.
* * lib.c (where, sel): Extend into hashes.Kaz Kylheku2014-06-273-20/+65
| | | | * txr.1: document hash support for select and where.
* Bugfix: apply_intrinsic and iapply must not destructivelyKaz Kylheku2014-06-274-22/+48
| | | | | | | | | | | | 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.
* * txr.1: Fixes in quasiquote description.Kaz Kylheku2014-06-261-16/+11
|
* * txr.1: Add some section headers, rearrange.Kaz Kylheku2014-06-261-92/+94
|
* Fixes to bignum bit operations affecting pretty much all bit operationsKaz Kylheku2014-06-263-8/+23
| | | | | | | | | | | | | | when bit field operands are negative, affecting logand, logor, logxor, lognot, logtrunc, logtest and ash. In addition, logtest was found to return the logical inverse of its correct value. * arith.c (logtest): Fix broken boolean polarity of return value. * mpi-patches/add-bitops (mp_2comp): Fix incorrect treatment of negative values. (mp_and): Fix incorrectly ordered statements, which cause failure when operands are negative.
* * eval.c (iapply_s): new global variable.Kaz Kylheku2014-06-263-8/+88
| | | | | | | | | | (iapply, me_ip): new static functions. (do_apf): Bugfix: use apply_intrinsic, not apply. (do_ipf, ipf): New static functions. (eval_init): initialize iapply_s. register me_ip macro expander, and the iapply and ipf functions. * txr.1: Documented iapply, ipf and ip.
* * lib.c (last): Bugfix: reversed null test.Kaz Kylheku2014-06-262-1/+5
|
* * eval.c (eval_init): register range_regex and tok_whereKaz Kylheku2014-06-267-4/+81
| | | | | | | | | | | | | | 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.
* * lib.c (search): Bugfix in type mismatch error message:Kaz Kylheku2014-06-262-1/+6
| | | | trying to print cons function pointer as value.
* * eval.c (mapcarv): Use mapcar_listout, so list_of_lists can beKaz Kylheku2014-06-265-4/+102
| | | | | | | | | | | | | 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.
* Bugfix: macros not being expanded in expansions embedded inKaz Kylheku2014-06-203-3/+52
| | | | | | | | | | | | | | quasilierals: i.e. the forms X and Y in `@{X}` and `@{X Y}`, where X and Y can be Lisp symbol macros or compound forms that is a macro call. * eval.c (expand_quasi): Handle the var forms in a quasi. * parser.y (n_exprs_opt, q_var): New grammar nonterminals. q_var is a clone of o_var, but with different construction behavior. It fixes the bug that o_var applies expand_meta to embedded Lisp forms, which is not appropriate for TXR Lisp quasiliterals. (quasi_item): Derive q_var rather than o_var.
* Optimization: add missing tail updates to some listKaz Kylheku2014-06-204-7/+19
| | | | | | | | | | | 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.c (do_apf, apf): New functions.Kaz Kylheku2014-06-203-0/+45
| | | | | | (eval_init): Register apf as intrinsic. * txr.1: Document apf.
* Improve error reporting.Kaz Kylheku2014-06-202-8/+21
| | | | | | | * eval.c (eval_error): Use last_form_evaled if form is null. (apply): Substitute apply symbol if ctx_form is null. (apply_intrinsic): Do not pass fake (apply) context form to apply, just pass nil.
* * eval.c (identity_s): New global variable.Kaz Kylheku2014-06-193-2/+127
| | | | | | | | | (me_ret, tf, nilf, do_retf, retf): New static functions. (eval_init): Initialize identity_s, and use it for registration of identity. Register ret macro, and the retf, tf and nilf functions. * txr.1: Documentation for ret, retf, tf and nilf.
* Bugfix: dwim operator contradicts the documentationKaz Kylheku2014-06-192-1/+12
| | | | | | | | | | and intended design. * eval.c (do_eval): When calling do_eval_args to evaluate the arguments of a compound form that is a function call, do not pass down the lookup function, but substitute &lookup_var. Passing down the lookup function means tha all evaluation enclosed in (dwim ...) or [...] follows the Lisp-1 style.
* * eval.c (me_ap): New static function.Kaz Kylheku2014-06-195-11/+123
| | | | | | | | | | | | | | (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.
* * eval.c (eval_init): Register member and member_if as intrinsics.Kaz Kylheku2014-06-186-137/+222
| | | | | | | | | | * lib.c (member, member_if): New functions. * lib.h (member, member_if): Declared. * txr.1: Documented. * txr.vim: Regenerated.
* * lib.c (generic_funcall): Bugfixes: support symbols.Kaz Kylheku2014-06-172-4/+28
| | | | | | | | 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.
* * txr.1: Fix broken examples for some and none functions.Kaz Kylheku2014-06-172-2/+6
|
* * eval.c (not_null): New static function.Kaz Kylheku2014-06-173-5/+48
| | | | | | | | (eval_init): Use null_f in existing registration of null and not. Add registration for not_null as "true", and for null_f as "false". * txr.1: Documented true and false.
* * eval.c (eval_init): register tuples as intrinsic.Kaz Kylheku2014-06-175-0/+81
| | | | | | | | | * lib.c (tuples_func): New static function. (tuples): New function. * lib.h (tuples): Declared. * txr.1: Documented.
* * lib.c (obj_print): Render character DC00 as "pnul".Kaz Kylheku2014-06-154-5/+45
| | | | | | | | | | | | | 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.
* * eval.c (eval_init): Register pos_max, pos_min, find_max,Kaz Kylheku2014-06-155-7/+201
| | | | | | | | | | | | | | | | | | 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.
* * eval.c (eval_init): where and sel registered as intrinsicsKaz Kylheku2014-06-155-5/+141
| | | | | | | | | | | | 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.
* Bugfix: range and range* broken when "to" argument isKaz Kylheku2014-06-152-5/+14
| | | | | | | | omitted. This was broken in version 89, by the 2014-04-08 commit. * eval.c (rangev_func, range_star_v_func): Only perform numeric tests between from and to if to is not nil.
* * Makefile: Install share/txr/stdlib/*.txr material.Kaz Kylheku2014-06-125-1/+20
| | | | | | | | | | | * match.c (do_txeval): If a variable is not in the bindings, fall back on treating it as a TXR Lisp dynamic variable. This allows us to refer to the stdlib variable from a quasistring in a @(load ...) directive. * txr.c (sysroot_init): Register new variable, *txr-version*. * share/txr/stdlib/ver.txr: New file.
* * match.c (v_load): use the abs_path_p function instead ofKaz Kylheku2014-06-126-2/+74
| | | | | | | | | | | | | checking for leading slash. * stream.c (abs_path_p): New function. (stream_init): Register abs_path_p as abs-path-p. * stream.h (abs_path_p): Declared. * txr.1: Documented abs-path-p. * dep.mk: Updated.
* Version 90txr-90Kaz Kylheku2014-06-117-113/+182
|
* * Makefile (txr.o): Pass TXR_VER preprocessor symbol on gcc commandKaz Kylheku2014-06-115-6/+50
| | | | | | | | | | | | | | | | | | | | line. (PREINSTALL): New variable holding a step for the install recipe. (pax tar zip): New targets. * configure (txr_ver): Version now added to config.make, passed through to txr.c. (gen_config_make): bindir, datadir and mandir are established using gmake's regular macro assignment (=) rather than expanding assignment (:=). This allows us to override the prefix variable after configure time. * lib.h (wli_noex): New macro. (wli): Retarget to wli_noex, so that argument is subject to macro replacement. * txr.c (version): Use TXR_VER defined on compiler command line, rather than hard-coded string literal.
* * eval.c (eval_init): Change registration of string_cmpKaz Kylheku2014-06-105-32/+111
| | | | | | | | | | | | | | | | | | | 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.
* 2014-06-10 Kaz Kylheku <kaz@kylheku.com>Kaz Kylheku2014-06-104-22/+49
| | | | | | | | | | | | | | | * Makefile (PROG): Removing ./ prefix from variable name; adding it to invocations of $(PROG) in some rules. (txr.o): Pass several strings as macros on the command line: TXR_REL_PATH, EXE_SUFF and PROG_NAME. * configure (bindir, datadir, mandir): These variables become just relative paths from the prefix. * txr.c (sysroot): Use the TXR_REL_PATH, EXE_SUFF and PROG_NAME preprocessor symbols defined on the command line to avoid hard-coding strings like "bin/txr" and "bin/txr.exe" which actually should reflect the value of the bindir variable.
* * txr.c (get_self_path): Fix spelling of GetModuleFileName.Kaz Kylheku2014-06-102-3/+17
| | | | | | Add missing parentheses in expression. (sysroot_init): On Windows, filter progpath to change backslashes to forward slashes.
* * parser.l (yylex_destroy): The FLEX_ version are prefixed with YY_Kaz Kylheku2014-06-102-5/+8
| | | | in old flexes too.
* New variable stdlib, with a sysroot mechanism to computeKaz Kylheku2014-06-092-0/+89
| | | | | | | | | the path based on the "sysroot" where it is actually installed. * txr.c (progname_8u, progpath): New static variables. (get_self_path, sysroot_helper, sysroot, sysroot_init): New static functions. Sysroot creates a stdlib variable. (main): Initialize progname_u8 value, and call sysroot_init.
* * lib.c (match_str): Extended to suffix testing, with a negativeKaz Kylheku2014-06-093-13/+44
| | | | | | start argument. * txr.1: Documented.
* * Makefile: fix broken tests; numerous test cases outputKaz Kylheku2014-06-092-1/+14
| | | | | bindings, and need the -B option. One test case does not need the -l option which now implies -B.
* * txr.c (txr_main): New option --args.Kaz Kylheku2014-06-093-21/+77
| | | | | | Also, put in missing check for -f being erroneously clumped. * txr.1: Documented.
* * txr.1: Clarify that -B is needed in some examples.Kaz Kylheku2014-06-091-30/+30
|
* The dumping of bindings and printing of false must nowKaz Kylheku2014-06-098-78/+48
| | | | | | | | | | | | | | | | | | | | | | | | | be explicitly requested by the -B option. * match.c (opt_nobindings): Variable removed. (opt_print_bindings): New variable. (extract): Print bindings or "false" if opt_print_bindings is true. * stream.c (output_produced): Variable removed. (stdio_put_string, stdio_put_char, stdio_put_byte): Remove update of output_produced. * stream.h (output_produced): Declaration removed. * txr.1: Documentation updated. * txr.c (txr_main): Option 'b' does nothing. 'B', 'l', 'a', and '--lisp-bindings' set opt_print_bindings to 1. * txr.h (opt_nobindings): Declaration removed. (opt_print_bindings): Declared. * unwind.c (uw_throw): When exiting due to a query error or file error, print false when opt_print_bindings is true.
* Fixing issue with list-like iteration over generic sequences,Kaz Kylheku2014-06-065-22/+195
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* * eval.c (eval_init): Register new search function as intrinsic.Kaz Kylheku2014-06-066-32/+164
| | | | | | | | | | | * lib.c (search_list): New static function. (search): New function. * lib.h (search): New function declared. * txr.1: Documented. * txr.vim: Regenerated.
* * configure: tabs to spaces.Kaz Kylheku2014-06-061-21/+21
|
* * parser.l: Adding an explicit lexical rule toKaz Kylheku2014-06-052-0/+12
| | | | | | catch backslashes occurring within a regex, not followed by a character. This can happen in dynamically parsed regexes such as "abc\\".
* * parser.l (yylex_destroy): Only rely on the FLEX_ versionKaz Kylheku2014-06-052-0/+8
| | | | | numbers if they are defined. In a newer flex, they are prefixed by YY_.
* * configure (lang_flags): Removing -D_BSD_SOURCEKaz Kylheku2014-06-052-2/+52
| | | | | | | | | | | | from lang_flags. Adding a test for determining which flag reveals BSD functions. This is due to the braindamaged way feature selection macros work on FreeBSD. There is no way to say "give me only the functions from a certain version of the Unix spec, plus traditional BSD functions", so we have to resort to using the internal symbol __BSD_VISIBLE. Also, changing the detection test for daemon function to the pointer-based approach.
* * configure (lang_flags): drop -D_POSIX_C_SOURCE=199309L.Kaz Kylheku2014-06-042-1/+6
| | | | This is subsumed by -D_XOPEN_SOURCE=500.
* * configure: Typo in diagnostic output: wspawnlp.Kaz Kylheku2014-06-042-1/+5
|