summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Version 257txr-257Kaz Kylheku2021-04-238-1348/+1425
| | | | | | | | | | | | | | | | | Log message correction superseding original commit 65213f5f7f6a204886a02c32f259ae2617d1dfb6. * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Bumped. * txr.vim, tl.vim: Regenerated. * protsymc.: Likewise * share/txr/stdlib/doc-syms.tl: Likewise.
* configure: clang banner moving target.Kaz Kylheku2021-04-221-1/+1
| | | | | | * configure: nopie test must check for "clang" in two places in the version banner. Some vendors stick their name in front of "clang".
* doc: remove hyphen from -s plurals.Kaz Kylheku2021-04-222-140/+143
| | | | | | | | | | * txr.1: After some some discussions with Paul A. Patience, I've decided to fix the instances where an identifier in italics or typewriter font is pluralized with -s to just use s. Some 140 instances are fixed. * checkman.txr: Allow exception for "s" in the rule that punctuation must follow codn/metn.
* matcher: compile the test cases.Kaz Kylheku2021-04-221-6/+13
| | | | | | | | * tests/011/patmatch.tl: Wrap one test with compile-only and eval-only so that the compiler ignores it. Add a form at the end of the file, similarly ignored by the compiler to compile the file. This compiles and executes all the test cases.
* compiler: bug: eliminate-frame not initializing tregs.Kaz Kylheku2021-04-221-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | In eliminate-frame, our stategy of replacing vregs with tregs assumes that the newly minted tregs are initialized to nil. This is true if the block is executed only once, but not true if it's in the middle of a loop, where the previous iteration's treg values can be present. This results in miscompilation of code like (when-match (@x @(all @x)) '(1 (1 2)) x) which wrongly returns 1 instead of nil starting at optimization level 2. * share/txr/stdlib/compiler.tl (struct compiler): New slot, loop-nest, indicating the loop nesting level. (compiler eliminate-frame): add instructions to the start of the block of code to null out all the tregs that we allocated for replacing vregs. We do this only when compiling the repeated parts of a loop, as indicated by a positive value of loop-nest. (comp-for): Increment loop-nest before compiling the repeated parts of the loop; decrement it afterward.
* compiler: bug: graph issue in dead code elimination.Kaz Kylheku2021-04-221-1/+4
| | | | | | | | | | | | | * share/txr/stdlib/optimize.tl (basic-blocks join-block): When we merge a block N with its physical predecessor P, we must iterate over the jump targets of N, and update their reverse list to point to P instead of N. A full call to link-graph would fix it also, but we don't call link-graph anywhere in the optimization pipeline after this point. The reverse links are relied on to be correct elsewhere, such merge-jump-tunks, which needs to walk the blocks which jump to a removed duplicate block, to retarget them to go to another copy of that block.
* compiler: bug: const-folded (call ...) not quoted.Kaz Kylheku2021-04-211-1/+1
| | | | | | | * share/txr/stdlib/compiler.tl (comp-apply-call): When a call expression is evaluated at compile time, we must quote the result, because it could be a non-self-evaluating symbol, or list.
* matcher: defmatch: useful :env parameter.Kaz Kylheku2021-04-213-11/+72
| | | | | | | | | | | | | | | | | | | * share/txr/stdlib/match.tl (compile-match): Pattern macro expanders now have an environment parameter. We turn the list of variables that have been bound so far into a fake macro-time lexical environment, the parent of which is the surrounding environment. The pattern macro can query this using the lexical-var-p function to determine whether a given variable already has a binding, either in the pattern, or in the surrounding lexical environment. (defmatch): Generate a two-argument lambda, and use the new mac-env-param-bind to make the environment object available to the user-defined expansion. * tests/011/patmatch.tl: New test cases for this environment mechanism, and also for defmatch itself. * txr.1: Document role of :env under defmatch.
* compile/eval: new operator, mac-env-param-bind.Kaz Kylheku2021-04-215-13/+117
| | | | | | | | | | | | | | | | | | | | | | mac-env-param-bind is like mac-param-bind but also allows the value for the :env parameter to be specified. * eval.c (op_mac_env_param_bind_s): New sy mbol variable. (op_mac_env_param_bind): New static function. (do_expand): Handle mac_env_param_bind_s. (eval_init): Initialize symbol variable and register macro. * share/txr/stdlib/compiler.tl (compiler compile): Add case for mac-env-param-bind. (compiler comp-mac-env-param-bind): New method. * share/txr/stdlib/doc-syms.tl: Updated with new hashes for tree-bind and mac-param-bind, and inclusion of mac-env-param-bind. * tests/012/binding.tl: New file. * txr.1: Documented.
* clang+amd4: fix stack alignment for continuations.Kaz Kylheku2021-04-201-1/+1
| | | | | | | | | | * unwind.h (UW_FRAME_ALIGN): Define on __amd64__, if compiled by __clang__. This is because MMX instructions are used for manipulating the stack which require 16 byte alignment. This was discovered as a bus error crash on OpenBSD in the tests/012/cont.tl test case, acessing otherwise perfectly valid memory. The faulting address was only 8 byte aligned, not 16.
* quips: two entries in Japanese.Kaz Kylheku2021-04-201-0/+2
| | | | | * share/txr/stdlib/quips.tl (%quips%): Song lyric parody of あなたに夢中 by キャンディーズ.
* matcher: new pattern operator @(end)Kaz Kylheku2021-04-204-44/+118
| | | | | | | | | | | | | | | * share/txr/stdlib/doc-syms.tl: New entry for end. * share/txr/stdlib/match.tl (check, check-end, check-sym, loosen, pat-len): New functions, taken from original local functions of sme macro. (sme): Refactored by hoisting local functions out. Some local variable renaming. (end): New pattern macro. * tests/011/patmatch.tl: New test for end. * txr.1: Documented.
* utf8: decode: reduce strictness of full unicode check.Kaz Kylheku2021-04-201-4/+4
| | | | | | | | * utf8.c (utf8_from_buf, utf8_deocde): On 16 bit wchar_t, we dont' have to throw on every value in the range 0xF0-0xFF. Only the values 0xF0 through 0xF4 are potential UTF-8 bytes; so we only need to error out on those. 0xF5 through 0xFF are invalid bytes, which we can map into the 0xDCNN range.
* tests: disable some UTF-8 tests on 16 bit wchar_t.Kaz Kylheku2021-04-201-8/+9
| | | | | * tests/012/parse.tl: All the tests in this file blow up on systems that don't have a full-blown character type.
* compile-file: fix bad diagnostic.Kaz Kylheku2021-04-201-1/+1
| | | | | | | * share/txr/stdlib/compiler.tl (open-compile-streams): When the output file cannot be opened, the diagnostic message wrongly refers to the input stream object rather than the output file path.
* configure: remove LIT_ALIGN.Kaz Kylheku2021-04-202-40/+3
| | | | | | | | | | | | | LIT_ALIGN was introduced before there was SIZEOF_WCHAR_T. The latter was introduced on suspicion that they might not be the same. Since LIT_ALIGN is tied to SIZEOF_WCHAR_T again there is no need for it to exist. * configure (lit_align): Variable removed. Documentation of lit-align argument removed. Alignment of wide literals test removed. Not generating LIT_ALIGN in config.h any more. * lib.h (LIT_ALIGN): Occurrences replaced with SIZEOF_WCHAR_T.
* Revert bogus LIT_ALIGN commit from 2015.Kaz Kylheku2021-04-203-56/+39
| | | | | | | | | | | | | | | | This reverts commit 0343c6f32c5bd8335e88595cb9d23506625b2586. I don't see evidence that the claim in the commit is true: that wide literals are not four-byte-aligned on Darwin in spite of sizeof(wchar_t) being 4. Not even with the old clang in my old VM where I first thought I discovered this. * configure: do not set up LIT_ALIGN == 2 for Darwin. * lib.h (litptr): Remove LIT_ALIGN < 4 && SIZEOF_WCHAR_T == 4 case. * HACKING: Undocument bogus claim.
* bug: broken path handling on LIT_ALIGN == 2.Kaz Kylheku2021-04-202-3/+3
| | | | | | | | | | | | On platforms where wchar_t literals have two byte alignment, these misbehave incorrectly, failing to treat / as a path separator. Thus (dir-name "a/b/c") is reported as ".". Lack of test coverage, argh. * stream.c (base_name, dir_name): Do not use wref macro on wli() string literal; the offset is already built-in. * txr.c (sysroot_init): Likewise.
* lib: missing L prefix in literal.Kaz Kylheku2021-04-201-1/+1
| | | | | | | * lib.h (wli_noex): The first of three literals being juxtaposed is missing the L prefix, leading to a mixture of wide and regular literals. This is supported by C, but let's avoid it.
* configure: better way to avoid -no-pie.Kaz Kylheku2021-04-201-12/+21
| | | | | | | | | | * configure (gcc_version, broken128): Formally declare existing ad hoc variables. (do_nopie): New variable. Compiler version test moved up. We use the gcc version to disable nopie, and check for clang to do the same. Instead of checking for darwin and android to skip the nopie stuff, we check do_nopie.
* openbsd: fix tests.Kaz Kylheku2021-04-205-32/+34
| | | | | | | | | | | | | | | | | | | * tests/014/socket-basic.tl (%iters%): Also reduce to 2000 on OpenBSD, to avoid the default limit on UDP datagram size. * tests/017/glob-carray.tl: Use the BSD-style struct glob-t on OpenBSD also. * tests/017/glob-zarray.tl: Likewise. * tests/018/chmod.tl (os): New global variable. (test-sticky): s-isvtx not allowed for non-root user on OpenBSD, so we falsify this variable. * tests/common.tl (os-symbol): Add OpenBSD case, producing :openbsd keyword symbol. (libc): Let's just use (dlopen nil) for any platform that isn't Cygwin or Cygnal.
* configure: use $makeKaz Kylheku2021-04-201-4/+4
| | | | | | * configure: in a few tests, we are calling make as "make" rather than via the $make variable. This fails when "make" isn't GNU Make.
* matcher: first pattern macro, sme.Kaz Kylheku2021-04-195-2/+210
| | | | | | | | | | | | * lisplib.c (match_instantiate): Intern sme symbol. * share/txr/stdlib/doc-syms.tl: Update with sme entry. * share/txr/stdlib/match.tl (sme): New defmatch macro. * tests/011/patmatch.tl: New tests for sme. * txr.1: Documented.
* doc: reversed maphash parameters.Kaz Kylheku2021-04-191-1/+1
| | | | | * txr.1: The function is first, then the hash. Reported by Ray Perry.
* defmatch: pass form to mac-param-bind.Kaz Kylheku2021-04-192-1/+23
| | | | | | | | * share/txr/stdlib/match.tl (defmatch): Pass *match-form* to mac-param-bind so that the context is available to defmatch macros via the :form parameter. * txr.1: Documented use of :form in defmatch.
* port: build on OpenBSDAlexander Shendi2021-04-183-0/+28
| | | | | | | | | | | | Tested on OpenBSD amd64. * socket.c: Add <sys/socket.h>. Test for AI_V4MAPPED and AI_ALL being defined. * sysif.c: Add <stdarg.h>. Test for EMULTIHOP, ENODATA, ENOLINK, ENOSR, ENOSTR, EPIPE and ETIME. * termios.c: est for OFILL, VTDLY, VT0 and VT1.
* compile/eval: print compiler error on *stderr*.Kaz Kylheku2021-04-193-2/+13
| | | | | | | | | | | | | | | | | | | | | | * share/txr/stdlib/error.tl (compile-error): Print the error message on *stderr*, like we do with warnings. This allows the programming environment to pick up the error message and navigate to that line accordingly. The error message is also output by the unhandled exception logic but with a prefix that prevents parsing by the tooling. To avoid sending double error messages to the interactive user, we only issue the *stderr* message if *load-recursive* is true. * tests/common.tl (macro-time-let): New macro. This lets us bind special variables around the macro-expansion of the body, which is useful when expansion-time logic reacts to values of special variables. * tests/012/ifa.tl: Use macro-time-let to suppress *stderr* around the expansion of the erroneous ifa form. We now needs this because the error situation spits out a message on *stderr*, in addition to throwing.
* new: remove superflous prefix from diagnostic.Kaz Kylheku2021-04-191-2/+1
| | | | | * share/txr/stdlib/struct.tl (new-expander): Don't format prefix into error message; compile-error does that.
* matcher: new @(scan) operator.Kaz Kylheku2021-04-184-2/+88
| | | | | | | | | | | | | | * share/txr/stdlib/match.tl (compile-scan-match): New function. (compile-match): Hook scan operator into compiler. * lisplib.c (match_set_entries): Ensure scan is interned in usr package. * txr.1: Documented. * share/txr/stdlib/doc-syms.tl: Updated with new entry for scan.
* matcher: allow user-defined patterns via defmatchKaz Kylheku2021-04-175-21/+133
| | | | | | | | | | | | | | | | | * lisplib.c (match_set_entries): Register defmatch and *match-symbol* to autoload match.tl. * share/txr/stdlib/doc-syms.tl: Updated with entries for defmatch and *match-macro*. * share/txr/stdlib/match.tl (*match-macro*): New special variable holding hash. (compile-match): Handle macros via *match-macro* hash. (defmatch): New macro. * txr.1: Documented. * tags.tl: Recognize defmatch forms.
* streams: revise stream-max-len over strings.Kaz Kylheku2021-04-172-30/+34
| | | | | | | | | | | | | | | | The maximum number of characters printed from a string is too small, if it is directly taken from the stream-max-len value. We are going to multiply it by 8, and clamp the minimum characters at 24. * lib.c (max_str_chars): New inline function. (lazy_str_put, out_lazy_str, out_quasi_str): Use inline function to determine maximum number of chracters to print. Also bugfix here: decrement and test max_chr in the loop, not max_len. This bug was copy-pasted across all these functions. (obj_print_impl): Similarly revise the printing of strings. * txr.1: Documentation updated.
* gc: disable z() macro.Kaz Kylheku2021-04-171-0/+5
| | | | | | * gc.h (z): turn off. This is not achieving its purpose of stopping spurious retention of objects, and adds a fraction of a percent of execution overhead.
* debugging: disassemble vm code out of debugger.Kaz Kylheku2021-04-162-0/+14
| | | | | | | | * lib.c (dis): New function that we can call from gdb to disassemble a VM function, if we know its address. I've done this manually way too many times. * lib.h (dis): Declared.
* txr: gather: report list of missing required vars.Kaz Kylheku2021-04-131-2/+8
| | | | | * match.c (v_gather): Identify all required variables that are missing, and list them all in the diagnostic.
* doc: implement typesetting of keystrokes.Kaz Kylheku2021-04-132-112/+435
| | | | | | | | | | | | | | | | | | | | This commit relies on parallel improvements in man2html, up through commit ac186529b6b5f80906c3215a67c98505db7bb156 "Implement .M2HT request for HTML passthrough." * genman.txr: Add CSS block targetting the kbd element, providing 3D styling for keyboard input. * txr.1: Define two new macros, .key and .keyn. These are defined in three different ways: in man page output, we put square brackets around keystrokes. In typeset groff output, we put a square border around them using a box macro cribbed from groff documentation. In HTML, we use .M2HT to wrap a <kbd> tag around the keystrokes. Documentatio is updated to use these macros for all keystrokes. We no longer separate keystroke sequence elements with commas.
* tests: use fixed regsub in compile test.Kaz Kylheku2021-04-131-1/+1
| | | | * tests/012/compile.tl: Simplify code with regsub.
* regex: regsub wrongly destructive.Kaz Kylheku2021-04-131-3/+4
| | | | | * regex.c (regsub): When the regex argument is actually a function, we must copy the string, because replace_str is destructive.
* vim: remove txr_keyword from tl.vim.Paul A. Patience2021-04-131-0/+2
| | | | | | * genvim.txr: the tl.vim file does not require a highlighting association between txr_keyword and Keyword, since it lacks the txr_keyword match group.
* repl: fix typo in plain mode banner.Paul A. Patience2021-04-131-1/+1
| | | | * txr.c (banner): wth -> with.
* tests: implicitly generate empty .expected files.Kaz Kylheku2021-04-1229-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makefile (%.expected): New implicit rule. Whenever a test requires a .expected file, if it is missing, we create an empty one. This file will be treated as an intermediate by GNU Make, which means that it will be deleted when make terminates. * tests/012/compile.tl: Some of the .tl files no longer have an .expected file, so we have to test for that in the catenating logic. * tests/008/call-2.expected, * tests/008/no-stdin-hang.expected, * tests/011/macros-3.expected, * tests/011/patmatch.expected, * tests/012/aseq.expected, * tests/012/ashwin.expected, * tests/012/compile.tl, * tests/012/cont.expected, * tests/012/defset.expected, * tests/012/ifa.expected, * tests/012/oop-seq.expected, * tests/012/parse.expected, * tests/012/quasi.expected, * tests/012/quine.expected, * tests/012/seq.expected, * tests/012/struct.expected, * tests/012/stslot.expected, * tests/014/dgram-stream.expected, * tests/014/in6addr-str.expected, * tests/014/inaddr-str.expected, * tests/014/socket-basic.expected, * tests/015/awk-fconv.expected, * tests/015/split.expected, * tests/015/trim.expected, * tests/016/arith.expected, * tests/016/ud-arith.expected, * tests/017/ffi-misc.expected, * tests/018/chmod.expected: Empty file deleted.
* compiler: new test case.Kaz Kylheku2021-04-111-0/+12
| | | | | | | | * tests/012/compile.tl (new-file): Compiles a select set of .tl files in the same directory. The compile.expected file is dynamically created from catenating the .expected files corresponding to those .tl files; the output is expected to be the same from compiling those files as from interpreting them.
* compiler: bugfix: rest parameter in inline lambdaKaz Kylheku2021-04-111-1/+4
| | | | | | | | | | | * share/txr/stdlib/compiler.tl (lambda-apply-transform): Do not take all of the fixed arguments and rest expression to be the trailing list. Rather, skip as many elements from these as the function has fixed parameters. E.g. if there are two fixed parameters as in (lambda (a b . c)) and the call specifies four fixed parameters and a trailing x (1 2 3 4 . x) then the rest argument c must be (list* 3 4 . x) and not (list* 1 2 3 4 . x).
* gc: code improvment in finalizer calling.Kaz Kylheku2021-04-111-1/+1
| | | | | | | | * gc.c (call_finalizers_impl): We don't have to null out the next pointer of the finalization entry in the loop and note that we are not doing this for the nodes that are going back into final_list. Rather, we null-terminate the found list at the end of the loop, just like we do with the final list.
* gc: sys:gc function must not reset full_gc flag.Kaz Kylheku2021-04-111-1/+2
| | | | | | | | * gc.c (gc_wrap): We must not set full_gc according to the argument, but only set it to 1 if the argument requests full GC. full_gc is set to 1 for some reason having to do with correctness; only the garbage collector can reset full_gc back to 0, otherwise incorrect behavior will ensue.
* compiler: bug: symbol not in ffuns in call forms.Kaz Kylheku2021-04-101-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | This bug causes forms like (call (fun 'foo) ...) not to register foo as a free reference in the function space, leading to inappropriate lambda lifting optimizations. The compiler thinks that a lambda is safe to move because that lambda doesn't reference any surrounding lexical functions, which is incorrect. A failing test case for this is (compile-file "tests/012/man-or-boy.tl") at *opt-level* 3 or higher. A bogus error occurs similar to "function #:g0144 is not defined", due to that function being referenced from a lifted lambda, and not being in its scope. * share/txr/stdlib/compiler.tl (compiler (comp-fun-form, comp-apply-call)): Pass the function symbol as an extra argument to comp-fun-form so that it's added to ffuns. (compiler comp-call-impl): Take new optional argument: a symbol to be added to the ffuns slot of the returned fragment, indicating that a function symbol is referenced.
* doc: redocument UTF-8 in source and literals.Kaz Kylheku2021-04-101-32/+48
| | | | | | | | | | | * txr.1: Because invalid UTF-8 bytes are allowed in string literals, that documentation needs to be updated. I'm rewriting it substantially to clarify the difference between text streams and parsing source. In the discussion of escape sequences in string literals, the wording is improved. Because the source code is UTF-8, we could plausibly support escapes which specify bytes (that are then decoded), so that's not the correct rationale for not supporting it.
* doc: remove some hyphenation.Kaz Kylheku2021-04-091-10/+10
| | | | | * txr.1: Do not hyphenate two's complement and C language, except in phrases like "C-language-style whatever".
* doc: lambda: add pointers to alternative notations.Kaz Kylheku2021-04-091-0/+75
| | | | | | * txr.1: Under the lambda operator, point to the op notational family, functional combinators and the OOP-related method and slot indirection.
* doc: more details in string literals section.Kaz Kylheku2021-04-091-0/+14
| | | | | * txr.1: advise user that numeric escapes in string literals are not byte-wise, but specify code points.
* doc: big patch: hyphenation, wording, formatting.Paul A. Patience2021-04-091-473/+573
| | | | | * txr.1: Numerous issues of hyphenation, formatting, and errors in typography and formatting are addressed.