summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* tests: fix malformed chmod.tl.Paul A. Patience2021-07-051-11/+11
| | | | | | * tests/018/chmod.tl (os): Fix final parentheses of defvarl form accidentally encompassing the rest of the source file. Replace tabs with spaces.
* doc-lookup: add support for OpenBSD.Paul A. Patience2021-07-051-2/+3
| | | | | * stdlib/doc-lookup.tl (os-symbol): Add case for OpenBSD. (open-url): Same.
* genman, lib, tests: use defvarl where possible.Paul A. Patience2021-07-0510-40/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * genman.txr (dupes, tagnum): Replace defvar with defvarl. * stdlib/doc-lookup.tl (os-symbol): Same. * tests/011/macros-3.tl (x): Same. * tests/011/mandel.txr (x-centre, y-centre, width, i-max, j-max, n) (r-max, pixel-size, x-offset, y-offset): Same. (file, colour-max): Delete (unused) variables. * tests/012/circ.tl (x): Replace defvar with defvarl. * tests/012/stack.tl (stack-limited): Same. * tests/012/struct.tl (s): Same. * tests/013/maze.tl (vi, pa, sc): Delete variables. Use function arguments instead. (usage): Fix typo. * tests/014/dgram-stream.tl (family): Rename to... (*family*): ...this. * tests/014/socket-basic.tl (socktype): Rename to... (*socktype*): ...this. (%iters%): Replace defvar with defvarl.
* build: update some targets.Paul A. Patience2021-07-051-10/+15
| | | | | | | | | | | | * Makefile (tainted): Fix typo. Reword sentence. (rebuild): Remove obsolete references to repatch target. (clean, distclean): Remove tst directory. Separate directory removals from file removals. Remove txr-manpage.html and txr-manpage.pdf in both distclean targets. In non-configured distclean, correct the removal of .tlo files to be from the stdlib directory rather than from share (and limit the pattern to *.tlo rather than *.tlo*, since .tlo2 files are no longer generated); and explicitly remove config.h and config.make, just like the configured distclean.
* Version 265.txr-265Kaz Kylheku2021-07-047-933/+993
| | | | | | | | | | | | | | * RELNOTES: Updated. * configure (txr_ver): Bumped version. * stdlib/ver.tl (lib-version): Bumped. * txr.1: Bumped version and date. * txr.vim, tl.vim: Regenerated. * protsym.c: Likewise.
* listener: treat unset and empty EDITOR the same.Paul A. Patience2021-07-042-2/+2
| | | | | | | * linenoise/linenoise.c (edit_in_editor): Treat empty EDITOR variable as if it were unset (i.e., do nothing). * txr.1: Documented.
* doc: check for spurious spaces.Paul A. Patience2021-07-042-4/+21
| | | | | | | | | | | * checkman.txr (check-spaces): New pattern function for checking for spurious spaces (i.e., two spaces or more in a row) in .meIP, .meti and .mets macros. * txr.1: Fix two instances of spurious spaces ("@\ newline" and "@\ space" examples). Conform the "@\x hex-digits" and "@\ octal-digits" examples to the fixed ones; this is more intuitive since there must be no space before the digits in the escape sequence.
* checkman: fix typos.Paul A. Patience2021-07-041-3/+2
| | | | | * checkman.txr (check-synb): Correct :min to :mintimes. (check-meti): Fix typo in comment.
* stack-limit: impose minimum limit.Kaz Kylheku2021-07-042-8/+18
| | | | | | | | | | | | | * gc.c (MIN_STACK_LIMIT): New preprocessor symbol. (gc_init): If the system stack limit is too low, don't treat that the same way as a missing or unlimited limit. Instead clamp to the minimum value and hope for the best. So that is to say, the system limit cannot be used as a mechanism to set a ridiculously low stack limit in TXR; the only way to do that is to use the set-stack-limit function. * txr.1: Documentation updated. Also fixed 326767 typo which should be 32767.
* stack-limit: always set a stack limit.Kaz Kylheku2021-07-041-0/+3
| | | | | | | | | | | Even if built without getrlimit, and even if getrlimit reports an unlimited stack size, set up a default limit. * gc.c (DFL_STACK_LIMIT): New preprocessor symbol, defined as 128 kilbytes for a small memory configuration, otherwise 16 megabytes. (gc_init): Set up a default stack limit unconditionally based on DFL_STACK_LIMIT before probing getrlimit.
* stack-limit: bug: not handling RLIM_INFINITY.Kaz Kylheku2021-07-042-7/+10
| | | | | | | | | | | | | | | | * gc.c (gc_init): We must check rlim_cur for the RLIM_INFINITY value indicating unlimited stack, and not misuse this value as a limit number, otherwise hilarity ensues. This reproduced on an older platform with make 3.81, which calls setrlimit to bring about an unlimited stack, passed on to child processes. Because of this txr segfaulted, as a consequence of a false positive. * tests/012/stack.tl (stack-limited): New variable which indicates whether there is a stack limit. If there isn't, we avoid running the fork-based test case. Also, we set the stack limit to 32768 so we have a limit against which to run some of the tests.
* autoload: missing lambda-excess-apply-list symbol.Kaz Kylheku2021-07-041-2/+2
| | | | | * lisplib.c (error_set_entries): Autoload error module on lambda-excess-apply-list, which was recently added.
* path-search: fix test for sh not being in /bin.Kaz Kylheku2021-07-041-1/+1
| | | | | * tests/018/path-test.tl: Check that the result of a path-search for "sh" only ends in "/bin/sh", not that it is precisely "/bin/sh".
* suffix functions: ignore trailing slashes.Kaz Kylheku2021-07-033-9/+27
| | | | | | | | | | | | | | | | Another requirements tweak to short-suffix and long-suffix: ignore one or more trailing slashes, instead of just one. This harmonizes with base-name, which does same, that requirement being copies from the POSIX basename utility. * stream.c (short_suffix, long_suffix): If sl points to a trailing slash which is the start of a suffix that consists of nothing but trailing slashes, then we pretend it isn't there. * tests/018/path.tl: Adjusted two existing test cases, and added more. * txr.1: Documented.
* doc: find-true spelling error.Kaz Kylheku2021-07-031-1/+1
| | | | | * txr.1: Fix "funtion" in description of new find-true function.
* doc: fix description and example of suffix funsPaul A. Patience2021-07-031-2/+2
| | | | | | | * txr.1: The suffix of path "abc." is ".". Fix the description for this case (which suggested the suffix was the empty string, which was the case before commit bf2e5199e8dbc4e6fd4fcac5dab1ea16f4ec5970) and one of the examples.
* doc: fix various issues.Paul A. Patience2021-07-033-619/+711
| | | | | | | | | | | | | | | | | | | * RELNOTES: Fix typos. * txr.1: Correct alist-remove and alist-nremove's argument lists (the keys are variadic). Remove "(the empty string)" from abs-path-p examples because it formats bizarrely in man output and is anyway mentioned in the description. Remove spurious spaces from .mets lines interfering with the formatting. Add some missing .code and .meta directives. Unitalicize words of Latin origin that have entered the dictionary ("de facto" and "vice versa"). Add hyphens to compound words used as adjectives. Remove hyphen from "non-matching". Move periods inside parentheses containing full sentences. Add missing words. Remove repeated words. Fix various other minor issues. * txr.c (help): Fix a typo. Clarify a description. Add missing periods. Make some other minor changes.
* compiler: inline lambda: fix : from apply-list caseKaz Kylheku2021-07-031-1/+2
| | | | | | | * stdlib/compiler.tl (lambda-apply-transform): When processing optional argument from apply-list, push an entry into check-opts, so the fixup code is generated for it. New test cases pass now.
* compiler: add failing inline lambda tests.Kaz Kylheku2021-07-031-0/+10
| | | | | * tests/012/lambda.tl: Add tests where apply list supplies : values to optional params, which must trigger defaulting.
* compiler: inline lambda: broken : args to optionals.Kaz Kylheku2021-07-031-5/+19
| | | | | | | | | | | | | | | The compiler test case fails on cases which pass a : value to an optional argument, which is supposed to trigger defaulting. * stdlib/compiler.tl (lambda-apply-transform): When processing an optional argument, if the argument is other than a constant expression evaluating to the : symbol, add an entry into a new check-opts list. This is later traversed to add code before the lambda body to check the optional parmeters for : values and do the init-form processing. The test cases pass with this, but it needs to be done in the case when optional values come from the apply list also; this is not being tested.
* compiler: inline lambda: not creating rest param.Kaz Kylheku2021-07-031-1/+1
| | | | | * stdlib/compiler.tl (lambda-apply-transform): In one case, the add call is missing to actually emit the rest parameter.
* tests: support for compiled test forms.Kaz Kylheku2021-07-032-23/+51
| | | | | | | | * tests/common.tl (*compile-test*): New variable. (vtest): Compile cases via compile-toplevel if *compile-test* is true, catching compile-time exceptions. * tests/012/lambda.tl: Set *compile-test* true and repeat file.
* compiler: typo in lambda error.Kaz Kylheku2021-07-021-1/+1
| | | | * stdlib/error.tl (lambda-too-few-args): Fix "inufficient".
* tests: include constp test in compile case.Kaz Kylheku2021-07-021-1/+1
| | | | * tests/012/compile.tl: Add const.tl file.
* tests: simplify file name handling in compile test.Kaz Kylheku2021-07-021-5/+5
| | | | | * tests/012/compile.tl: Remove suffixes from name list, and simplify code.
* lambda: tests.Kaz Kylheku2021-07-021-0/+88
| | | | * tests/012/lambda.tl: New file.
* constantp: tests.Kaz Kylheku2021-07-021-0/+23
| | | | * tests/012/const.tl: New file.
* tree: expose missing tnodep.Kaz Kylheku2021-07-021-0/+1
| | | | | | * tree.c (tree_init): Register tnodep as intrinsic function. This is documented! Another discrepancy found thanks to the new piece of code in genman.txr.
* signal: fix typo causing missing itimer-prof.Kaz Kylheku2021-07-021-1/+1
| | | | | | | | | | * signal.c (sig_init): Register ITIMER_PROF as the documented itimer-prof, not the undocumented itimer-prov. Anyone depending on this will have to fix their code to use the new variable, or else (defvarl itimer-prof itimer-prov). This was discovered due to Paul A. Patience's doc-syms scrubbing code recently added to genman.txr, which identifies documented symbols not present in the actual image.
* doc: cptr-put does not exist.Kaz Kylheku2021-07-022-6/+6
| | | | | | | | | | | * txr.1: There is no cptr-put function; it is called cptr-out. The last paragraph refers to cptr-out and it is referenced elsewhere. It has to be cptr-out because it implements the "out semantics" in FFI conversion which pairs with "put"; cptr-put would be a different function, which is not currently implemented. * stdlib/doc-syms.tl: Updated.
* doc: check the contents of doc-syms.Paul A. Patience2021-07-012-4/+23
| | | | | | | * genman.txr: Before generating stdlib/doc-syms.tl, check that the symbols going into that file (i.e., into the doc-syms variable) are actually contained in the TXR image (allowing for some exceptions). Also, reindent some lines.
* packages: find-symbol behaving like find-symbol-fb.Kaz Kylheku2021-07-021-11/+0
| | | | | | * lib.c (find_symbol): This function is identical to find_symbol_fb. The code for searching the fallback list must be removed.
* genvim.txr: remove unused variable pkg-name.Paul A. Patience2021-07-011-1/+0
|
* doc: fix various issues in .coNP lines.Paul A. Patience2021-07-013-131/+133
| | | | | | | | | | | * txr.1: Make consistent the style for ellipses in .coNP lines (i.e., without the word "and"). Emend some incorrectly named symbols. Fix various typos and other inconsistencies in .coNP lines. * checkman.txr (check-func): Add exception for caar. Add missing patterns for "Pattern macro", "Operator/function" and "Macro/function". * stdlib/doc-syms.tl: Updated.
* main: maintain -b option.Kaz Kylheku2021-07-011-13/+21
| | | | | | | | | | * txr.c (help): Remove -b help text which pertains to an ancient -b option that was deprecated in 2014. Add correct help text for -b. (txr_main): Use split_str for the argument of -b. If it fails to produce a two-element list, it means the equal sign is missing; issue an error message and exit. Thereby we avoid passing nil as the input source argument of lisp_parse.
* streams: tightening sloppy argument defaulting.Kaz Kylheku2021-07-014-54/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Numerous functions in TXR Lisp treat a nil argument for an optional parameter as if it were omitted. In the case of streams, this can cause problems. An accidental nil passed to an input function can cause it to read from standard input and hang. In this patch, argument defaulting is tighented for functions that perform I/O. It's mostly stream parameters, but not exclusively. * eval.c (prinl, pprinl): Use default_arg_strict to default the stream argument, and also re-use that value for the put_char call. * lib.c (lazy_stream_cons, print, pprint, put_json): Use default_arg_strict rather than default_arg. * parser.c (regex_parse, lisp_parse_impl, txr_parse): Tighten the defaulting of the input stream and error stream arguments, streamlining the logic at the same time. * stream.c (do_parse_mode): Use default_arg_strict for the mode string argument. (record_adapter, get_line, get_char, get_byte, get_bytes, unget_byte, put_buf, fill_buf, fill_buf_adjust, get_line_as_buf, put_string, put_char, put_byte, put_line, flush_stream, get_string): Use strict defaulting for stream argument. (mkstemp_wrap): Use strict defaulting for suffix.
* doc: include opt-error in diagram.Kaz Kylheku2021-06-301-0/+2
| | | | * txr.1: Exception hierarchy diagram now includes opt-error.
* getopts: autoload: opt-error not interned.Kaz Kylheku2021-06-301-1/+1
| | | | | | * lisplib.c (getopts_set_entries): Add opt-error to list of interned symbols. Without this, getopts throws sys:opt-error. Reported by Paul A. Patience.
* compiler: inline lambda: another apply-list diagnosis bug.Kaz Kylheku2021-06-301-2/+8
| | | | | | | | * stdlib/compiler.tl (lambda-apply-transform): There is a bug in the case when all required and optional parameters have been satisfied. In the sub-case when there are no fixed parameters, we need to handle the run-time situation of there being a non-empty apply list, but no rest variable.
* op: refactor do handling.Kaz Kylheku2021-06-301-19/+37
| | | | | | | | | | | | | | | * stdlib/op.tl (op-expand): The logic involving the multiple expansions of do is consolidated into one step, so that everything is taken care of by the time syntax-1 is produced. Immediately when the initial unsuffixed arguments expand successfully, we check or the presence of metas and add the @1 if metas are absent. In the case of expanding with the gensym, we immediately replace that with @1 without using symacrolet. The do-gen variable is gone. Later, when calculating lambda-interior, there are no hacky additional passes to deal with; that block of code just refers to syntax-2. The do case is folded together with the have-metas case. Also adding copious comments to this hard-to-follow logic.
* op: bug in do: must insert @1 into unexpanded form.Kaz Kylheku2021-06-292-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In the case when the do syntax has no metavariables, and it expands as-is without the addition of symbol in the tail position, we are doing something wrong: we are adding the @1 into the expanded version of the form, rather than the original. For instance: 1> (expand '(do pop a)) (lambda (#:arg-1-0017 . #:arg-rest-0016) (prog1 (car a) (sys:setq a (cdr a)) #:arg-1-0017)) Here, the @1 was inserted into the (prog1 ...) form which is the expansion of pop. This is incorrect; it must be inserted into the original (pop a) syntax as (pop a @1). * op.tl (op-expand): In this case when there are no metas and no do-gen that can be replaced by @1 via symacrolet, go back to the original args syntax, add the arg1 meta into that syntax, and process it from the beginning through parallel expansions steps. * tests/012/op.tl: Couple of tests added.
* compiler: bug: diagnose excess args from apply list.Kaz Kylheku2021-06-292-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | When we compile an immediately applied lambda like (apply (lambda (a b c) ...) list), we are not emitting code to handle the run-time situation when there are too many elements in the list. This shows up in exception handling, for instance; the compiled version of this executes silently and returns 42: (catch (throw 'foo 5) (foo () 42))) foo is must have a parameter to capture the 5; interpreted code enforces this. * stdlib/compiler.tl (lambda-apply-transform): In the apply-list case, at the end of binding all the optional arguments, if the parameter list doesn't have a rest parameter to take any remaining items, we emit code to check that there aren't any; that everything has been popped out of the apply list, leaving it nil. If not, we call the run-time support function lambda-excess-apply-list. * stdlib/error.tl (lambda-excess-apply-list): New function.
* path-cat: becomes variadic.Kaz Kylheku2021-06-293-8/+103
| | | | | | | | | | | | | * stream.c (path_vcat): New static function. (stream_init): Register path-cat instrinsic to path_vcat rather than path_cat. * tests/018/path.tl: path-cat tests: all examples from documentation, plus others. * txr.1: Documented existing behaviors that were not clear, like when inputs are empty. Documented new variadic semantics. Examples added.
* path-cat: error if arguments are not strings.Kaz Kylheku2021-06-291-2/+2
| | | | | * stream.c (path_cat): Use length_str to enforce a type check. Otherwise, for instance, (path-cat #() "foo") will return "foo".
* doc: mistake in several path-cat examples.Kaz Kylheku2021-06-291-3/+3
| | | | | * txr.1: Corrections to three examples, where one operand is empty, and thus the other is returned.
* doc-lookup: use BROWSER variable; provide fallback.Kaz Kylheku2021-06-292-5/+40
| | | | | | | | | * stdlib/doc-lookup.tl (open-url): On non-Windows platforms, search for a program specified by the BROWSER variable, then by the URL-opening utility, and finally thorugh a fallback list of browsers. * txr.1: Documentation updated.
* New function: find-true.Kaz Kylheku2021-06-295-3/+86
| | | | | | | | | | | | | | | This is like find-if, but returns the value of the predicate function rather than the item. * eval.c (eval_init): Register find-true instrinsic. * lib.c (find_true): New function. * lib.c (find_true): Declared. * stdlib/doc-syms.tl: Updated. * txr.1: Documented.
* New function: path-search.Kaz Kylheku2021-06-295-1/+103
| | | | | | | | | | | | * lisplib.c (path_test_set_entries): Autoload on path-search. * stdlib/path-test.tl (path-search): New function. * tests/018/path-test.tl: New file. * txr.1: Documented. * stdlib/doc-lookup.tl: Updated.
* doc-lookup: handle xdg-open not terminating.Kaz Kylheku2021-06-291-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | It is common for web browsers like firefox not to fork themselves into the background when initially run from the command line. Only when an additional instance is executed does that instance terminate immediately, passing the URL to the existing instance. (Which also does not constitute forking into the background, but does have the effect of an immediate exit.) User Paul A. Patience reports that some installations of xdg-open have the isssue of not handling this situation; these versions of xdg-open wait for the browser to terminate, which causes xdg-open to hang until the browser is closed if it is the initial instance. * stdlib/doc-lookup.tl (detached-run): New function. Like run, but forks into the background, running the process in a detached grandchild whose parent terminates, so that it becomes an orphan parented to the init daemon. We redirect *stdout* to *stdnull* because the first instance of the browser can spit ugly, meaningless diagnostics when it terminates. (open-url): Use detached-run instad of run. Don't check the return value for zero; there is no integer exit status.
* doc-lookup: *doc-url* variable must be dynamic.Kaz Kylheku2021-06-281-1/+1
| | | | | * stdlib/doc-lookup.tl (*doc-url*): Define with defvar, not defvarl. Problem reported by Paul A. Patience.