summaryrefslogtreecommitdiffstats
path: root/share
Commit message (Collapse)AuthorAgeFilesLines
* New: mkdtemp and mkstemp functions.Kaz Kylheku2021-05-311-0/+2
| | | | | | | | | | | | | | | | * configure: check for mkstemp and mkdtemp. * stream.c (stdio_set_prop): Implement setting the :name property. We need this in mkstemp_wrap in order to punch in the temporary name, so that the application can retrieve it. (mkdtemp_wrap, mkstemp_wrap): New functions. (stream_init): Register mkdtemp and mkstemp intrinsics. * stream.h (mkdtemp_wrap, mkstemp_wrap): Declared. * txr.1: Documented. * share/txr/stdlib/doc-syms.tl: Updated.
* New function: tmpfile.Kaz Kylheku2021-05-311-0/+1
| | | | | | | | | | | * stream.c (tmpfile_wrap): New static function. (stream_init): Register tmpfile intrinsic. * stream.h (tmpfile_wrap): Declared. * txr.1: Documented. * share/txr/stdlib/doc-syms.tl: Updated.
* doc: document all json I/O convenience routines.Kaz Kylheku2021-05-301-86/+96
| | | | | | | | | * txr.1: Documented file-get-json, file-put-json, file-append-json, file-get-jsons, file-put-jsons, file-append-jsons, command-get-json, command-put-json, command-get-jsons, command-put-jsons. * share/txr/stdlib/doc-syms.tl: Updated.
* json: convenience I/O routines.Kaz Kylheku2021-05-301-0/+53
| | | | | | | | | | | | | | * lisplib.c (getput_set_entries): Register autoload for get-jsons, put-jsons, file-get-json, file-put-json, file-append-json, file-get-jsons, file-put-jsons, file-append-jsons, command-get-json, command-put-json, command-get-jsons and command-put-jsons. * share/txr/stdlib/getput.tl (get-jsons, put-jsons, file-get-json, file-put-json, file-append-json, file-get-jsons, file-put-jsons, file-append-jsons, command-get-json, command-put-json, command-get-jsons and command-put-jsons): New functions.
* json: functions put-json and put-jsonl.Kaz Kylheku2021-05-291-0/+2
| | | | | | | | | | | | | | | | | | | | | * eval.c (eval_init): Register put-json and put-jsonl intrinsics. * lib.c (out_json_str): Do not output the U+DC01 to U+DCFF code points by masking them and using put_byte. This is unnecessary; if we just send them as-is to the text stream, the UTF-8 encoder does that for us. (put_json, put_jsonl): New functions. * lib.h (put_json, put_jsonl): Declared. * txr.1: Documented. The bulk of tojson is moved under the descriptions of these new functions, and elsewhere where the document pointed to tojson for more information, it now points to put-json. More detailed description of character treatment is given. * share/txr/stdlib/doc-syms.tl: Updated.
* compiler: mov into t0 bug in compiling catch formKaz Kylheku2021-05-291-6/+8
| | | | | | | | | * share/txr/stdlib/compiler.tl (compiler comp-catch): The tfrag's output register may be (t 0) in which case the maybe-mov in the cfrag code generates a mov into (t 0) which is not allowed. Instead of tfrag.oreg we create an abstrction coreg which could be either toreg or oreg and consistently use it.
* parser: remove some parser access functions.Kaz Kylheku2021-05-281-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | * parser.c (lisp_parse_impl): Access pi->eof directly instead of going through parser_eof. We are using pi->errors in the same expression! This is the only place pi->eof is needed. (read_file_common): Don't call parser_eof. Assume that if error_val emerges, and errors is zero, it must be eof. (read_eval_ret_last): Simplify: the code actually does nothing specia for eof versus errors, so we just bail if error_var emerges. (get_parser): Function removed. (parse_errors): This is the only caller of get_parser, which now just calls gethash to fetch the parser. (parser_eof): Function removed. (parse_init): sys:get-parser, sys:parser-errors and sys:parser-eof intrinsics removed. The C function parser_errors still exists; it is used in a few places. * parser.h (get_parser, parser_eof): Declarations removed. * share/txr/stdlib/compiler.tl (compile-file-conditionally): Use the new parse-errors function instead of the removed sys:parser-errors. Since that works on the stream, we don't have to call sys:get-parser. Because it returns nil if there are no errors, we drop the > test.
* parser: provide parse-errors function.Kaz Kylheku2021-05-281-0/+1
| | | | | | | | | | * parser.c (parse_errors): New function. * parser.h (parse_errors): Declared. * txr.1: Documented. * share/txr/stdlib/doc-syms.tl: Updated.
* json: get-json function.Kaz Kylheku2021-05-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * eval.c (eval_init): get-json intrinsic registered. * parser.c (prime_parser): Handle prime_json. (lisp_parse_impl): Take enum prime_parser argument directly instead of the interactive flag. (lisp_parse, nread, iread): Pass appropriate prime_parser value instead of the original flag. (get_json): New function. Like nread, but passes prime_json. * parser.h (enum prime_parser): New constant, prime_json. (get_json): Declared. * parser.l (prime_scanner): Handle prime_json. * parser.y (SECRET_ESCAPE_J): New terminal symbol. (spec): New productions around SECRET_ESCAPE_J for parsing JSON. * lex.yy.c.shipped, y.tab.c.shipped, y.tab.h.shipped: Updated. * txr.1: Documented. * share/txr/stdlib/doc-syms.tl: Updated.
* json: tojson function.Kaz Kylheku2021-05-281-0/+1
| | | | | | | | | | | | * eval.c (eval_init): tojson intrinsic registered. * lib.c (tojson): New function. * lib.h (tojson): Declared. * txr.1: Documented. * share/txr/stdlib/doc-syms.tl: Updated.
* doc: document json syntax support.Kaz Kylheku2021-05-271-124/+125
| | | | | | * txr.1: Documented #J, #J^ and json macro. * share/txr/stdlib/doc-syms.tl: Updated.
* Version 260txr-260Kaz Kylheku2021-05-261-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Bumped. * txr.vim, tl.vim: Regenerated.
* doc: issue in identity function heading.Kaz Kylheku2021-05-251-2/+3
| | | | | | | * txr.1: Fix heading repeating identity instead of listing idenitty and identity*. * share/txr/stdlib/doc-syms.tl: Regenerated.
* matcher: allow hash pattern to omit values.Kaz Kylheku2021-05-241-7/+29
| | | | | | | | | | | | The @(hash ...) operator now allows key-only patterns like (42) or (@x), where x could be bound or unbound. This has separate semantics from when a value is present. * share/txr/stdlib/match.tl (compile-hash-match): Implement. * tests/011/patmatch.tl: Test. * txr.1: Document.
* matcher: fix funny comma placement.Kaz Kylheku2021-05-241-2/+2
| | | | | | * share/txr/stdlib/match.tl (compile-hash-match): Fix unquoting comma that had been strangely moved to the previous line.
* compiler: bugfix: warnings deferred too far.Kaz Kylheku2021-05-231-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Because with-compilation-unit is keyed of *load-recursive*, when compilation is happening in the context of a load (a top-level form in a loaded file calls compile-file or compile-update file) warnings are deferred until the end of the load. That might never occur if the load doesn't complete, because, say, the image quits for some reason. If the following is the content of a file which is loaded: (compile-file "foo") (exit 0) then warnings during the compilation are not issued when compile-file terminates, and will never be issued because of the termination due to the exit call. * share/txr/stdlib/compiler.tl (*in-compilation-unit*): New special variable. (with-compilation-unit): Use *in-compilation-unit* to determinw when a compilation unit has ended, and dump all the deferred warnings then. We will bind *load-recursive* because that is required for deferring warnings.
* quips: new TTY joke, and take on familiar saying.Kaz Kylheku2021-05-211-0/+2
| | | | * share/txr/stdlib/quips.tl (%quips%): Entries added.
* compiler: better code for global var definitions.Kaz Kylheku2021-05-141-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | * eval.c (rt_defvarl): More accurate self string. (rt_defv): New static function: like rt_defvarl but ensures that the new variable has a binding cell, and returns that cell instead of the hash cell. (op_defvarl): Take advantage of rt_defv to not have to cons up the binding cell. (eval_init): Register sys:rt-defv intrinsic. * parser.c (read_file_common): Compiled files are now version 7, so we must recognize them. We still load version 6 files because rt:defvarl still exists for them. * share/txr/stdlib/compiler.tl (expand-defvarl): Improve the generated code in two ways. Firstly, use the new sys:rt-defv, which returns the binding cell, so that the value can be stored into it with rplacd without having to cons up anything. Secondly, if there is no value expression, don't emit the code to do the assignment. (%tlo-ver%): Bump compiled file version to (7 0). * txr.1: Add note about TXR 260 loading version 7 and 6.
* doc: sort doc-syms, and html-decode.Kaz Kylheku2021-05-131-2048/+2049
| | | | | | | | | | | * genman.txr: generate doc-syms as a sorted list fed to hash-from-pairs. Now the symbols won't jump around so much whenever we update it. Also, the names must be HTML-decoded. For instance "str<" was being stored as "str&lt;" causing (doc 'str<) to fail. We use TXR @(output) to adjust the formatting as if it were maintained by hand. * share/txr/stdlib/doc-syms.tl: Regenerated.
* Version 259txr-259Kaz Kylheku2021-05-131-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Bumped. * txr.vim, tl.vim: Regenerated.
* doc: nonexistent tree-value-atKaz Kylheku2021-05-111-1/+1
| | | | * txr.1: Fix typos: tree-value-at should be trie-value-at.
* tree: streamline iteration; provide high limit.Kaz Kylheku2021-05-111-1565/+1563
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Getting rid of tree-begin-at and tree-reset-at. Now tree-begin takes two optional parameters, for specifying high and low range. * tree.c (struct tree_diter): New members, tree and highkey. We need tree due to requiring access to the less function. If the iterator has no highkey, the iterator itself is stored in that member to indicate this. (tree_iter_mark): Mark the tree and highkey. (tree_begin): Take optional lowkey and highkey arguments, initializing iterator acordingly. (tree_begin_at): Function removed. (copy_tree_iter, replace_tree_iter): Copy tree and highkey members. The latter require special handling due to the funny convention for indicating highkey absence. (tree_reset): Take optional lowkey and highkey arguments, configuring these in the iterator being reset. (tree_reset_at): Function removed. (tree_next, tree_peek): Implement highkey semantics. (sub_tree): Simplified: from and to arguments are just passed through to tree_begin, and there is no need for a separate loop which enforces the upper limit, that now being handled by the iterator itself. (tree_begin): Update registrations of tree-begin and tree-reset; remove tree-begin-at and tree-reset-at intrinsics. * tree.h (tree_begin_at, tree_reset_at): Declarations removed. (tree_begin, tree_reset): Declarations updated. * lib.c (seq_iter_rewind, seq_iter_init_with_info, where, populate_obj_hash): Default new optional arguments in tree_begin and tree_reset calls. * parser.c (circ_backpatch): Likewise. * tests/010/tree.tl: Affected cases updated. * txr.1: Documentation updated. * share/txr/stdlib/doc-syms.tl: Regenerated.
* tree: support indexing and range extraction.Kaz Kylheku2021-05-111-1564/+1565
| | | | | | | | | | | | | | | | | | | * lib.c (do_generic_funcall): Support tree object invocation with one or two arguments via sub and ref. (sub): Implement for trees via sub_tree. (ref): Implement for trees via tree_lookup. * tree.c (sub_tree): New function. (tree_init): Register sub-tree intrinsic. * tree.h (sub_tree): Declared. * tests/010/tree.tl: New tests. * txr.1: Documented: DWIM bracket syntax on trees, sub and ref support for trees, sub-tree function, * share/txr/stdlib/doc-syms.tl: Regenerated.
* tree: replace-tree-iter function.Kaz Kylheku2021-05-111-1/+2
| | | | | | | | | | | | | * tree.c (replace_tree_iter): New function. (tree_init): Register replace-tree-iter intrinsic. * tree.h (tree_init): Declared. * share/txr/stdlib/doc-syms.tl: Updated. * txr.1: Documented. * tests/010/tree.tl: New test case.
* tree: copy-tree-iter function.Kaz Kylheku2021-05-101-1/+2
| | | | | | | | | | | | | | | * lib.c (copy): Handle tree_iter_s via copy_tree_iter. * tree.c (copy_tree_iter): New function. (tree_init): copy-tree-iter intrinsic registered. * tree.h (copy_tree_iter): Declared. * tests/010/tree.tl: New test case. * txr.1: Documented. * share/txr/stdlib/doc-syms.tl: Updated.
* tree: new tree-peek function.Kaz Kylheku2021-05-091-3/+5
| | | | | | | | | | | | | | * tree.c (tn_peek_next): New static function. (tree_peek): New function. (tree_init): Register tree-peek intrinsic. * tree.h (tree_peek): Declared. * txr.1: Documented. * tests/010/tree.c: Work tree-peek into existing test case. * share/txr/stdlib/doc-syms.tl: Updated.
* matcher: new "each-match family" of macros.Kaz Kylheku2021-05-042-6/+43
| | | | | | | | | | | | | | | | | | * lisplib.c (match_set_entries): New autoload symbols: each-match, append-matches, keep-matches, each-match-product, append-match-products, keep-match-products. * share/txr/stdlib/doc-syms.tl: Updated. * share/txr/stdlib/match.tl (each-match-expander): New function. (each-match, append-matches, keep-matches, each-match-product, append-match-products, keep-match-products): New macros. * tests/011/patmatch.tl: New tests covering each macro, far from exhaustively. * txr.1: Documented.
* compiler: bug: not warning bad uses of some local funs.Kaz Kylheku2021-05-031-2/+3
| | | | | | | | | | | | | | | | | | When a lexical function defined with flet or labels is called with the wrong arguments, this is not being diagnosed if that function is being lifted to load-time. This is because the sys:load-time-lit that the lambda is wrapped with is not propagating the pars attribute of the frag structure from the lambda to its own returned frag. * share/txr/stdlib/compiler.tl (compiler comp-load-time-lit): After compiling the expression to obtain the exp frag, stuff exp.pars to both the lt-frag that is generated, as well as to the returned dummy frag carrying the dreg access that retrieves the function. It's important for this returned frag to carry the info, because from there it is propagated to the function binding by comp-fbind by the (set bind.pars frag.pars) expression.
* rel-path: bugfixes.Kaz Kylheku2021-05-031-9/+14
| | | | | | | | | | | | | | | * share/txr/stdlib/copy-file.tl: When removing .. components, a dotdot must only cancel preceding non-dotdot. We must check not only that the out stack is not empty but that the top element isn't dotdot. Also, eliminate empty components, like the documentation says. Lastly, we must check for the impossible cases, when the from path uses .. components that are impossible to navigate backwards to form a relative path. * tests/018/rel-path.tl: Test cases added. * txr.1: Updated with additional descriptions, fixes and examples.
* New function: rel-path.Kaz Kylheku2021-05-032-0/+33
| | | | | | | | | | | | | * lisplib.c (copy_file_set_entries): Add rel-path as autoload trigger for copy-file module. * share/txr/stdlib/copy-file.tl (rel-path): New function. * tests/018/rel-path.tl: New file. * txr.1: Documented. * share/txr/stdlib/doc-syms.tl: Updated.
* New function: portable-abs-path-p.Kaz Kylheku2021-05-021-1/+2
| | | | | | | | | | | | | | | * share/txr/stdlib/doc-syms.tl: Updated. * stream.c (portable_abs_path_p): New function, exact copy of old abs_path_p. (abs_path_p): Rewritten to be specific to host platform. No Windows-drive-like prefixes are checked on POSIX. (stream_init): Register new function. Register abs-path-p conditionally based on 258 compatibility. * stream.h (portable_abs_path_p): Declared. * txr.1: Documented, with compat notes.
* Version 258txr-258Kaz Kylheku2021-05-011-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Bumped. * txr.vim, tl.vim: Regenerated.
* tree: new functions for reseting iterator.Kaz Kylheku2021-04-301-1/+3
| | | | | | | | | | | | | | * tree.c (tree_reset, tree_reset_at): New functions. (tree_init): tree-reset and tree-reset-at intrinsics registered. * tree.h (tree_reset, tree_reset_at): Declared. * tests/010/tree.tl: New tests. * txr.1: Documented. * share/txr/stdlib/doc-syms.tl: Updated.
* tree: new tree-begin-at function.Kaz Kylheku2021-04-291-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tree.c (enum tree_iter_state): New iterator state tr_find_low_prepared dedicated to the tree-begin-at traversal. This state indicates that tree-next should visit the starting node that it is given, and then after that, treat anything to the left of it as having been visited. In the other states, tree-next does not visit the node it is given but uses it as the starting point to find the next node. (tn_find_next): Bugfix here: when navigating the right link, the function neglected to add the node to the path. But the logic for backtracking up the path expects this: it checks whether the node from the path is the parent of a right child. Somehow this didn't cause a problem for full traversals with tree-begin; at least the existing test cases don't expose an issue. It caused a problem for tree-begin-at, though. (tn_find_low): New static function. This finds the low-key node in the tree, priming the iterator object with the correct state and path content to continue the traversal from that node on . We need the tr_find_low_prepared state in the iterator in order to visit the low node itself that was found. (tree_begin_at): New function. (tree_init): Register tree-begin-at intrinsic. * tree.h (tree_begin_at): Declared. * tests/010/tree.tl: New test cases for tree-begin-at. * txr.1: Documented. * share/txr/stdlib/doc-syms.tl: Updated.
* tree: more tests.Kaz Kylheku2021-04-291-100/+101
| | | | | | * tests/010/tree.tl: New tests, broadening coverage. * share/txr/stdlib/doc-syms.tl: Regenerated.
* matcher: quasi match incorrectly treats nil as bound.Kaz Kylheku2021-04-261-1/+1
| | | | | | | | | | | | * share/txr/stdlib/match.tl (expand-quasi-match): bound-p local function must return nil if the symbol is nil. * share/txr/stdlib/match.tl: New test cases testing that @nil is treated as an unbound variable in the non-consecutive-variables test. Also, making duplicates of certain tests that start with a text match and sticking @nil as the first element into them, so that the text match is forced to be the second item.
* matcher: use match-str instead of sub-str and str=Kaz Kylheku2021-04-261-4/+4
| | | | | | * share/txr/stdlib/match.tl (expand-quasi-match): Don't extract substrings with sub-str; use match-str to match in-place.
* matcher: bugfix in `text{rest}` case.Kaz Kylheku2021-04-261-2/+2
| | | | | | * share/txr/stdlib/match.tl (expand-quasi-match): Calculate npos correctly relative to current pos. Use match-str rather than starts-with.
* matcher: diagnose unhandled quasiliteral cases.Kaz Kylheku2021-04-261-1/+6
| | | | | | | * share/txr/stdlib/match.tl (expand-quasi-match): Close the gap in the expander by diagnosing all unhandled syntax. There is now enough useful functionality and stability to start documenting the feature.
* match: third round of quasi tests and fixes.Kaz Kylheku2021-04-251-0/+8
| | | | | | | * share/txr/stdlib/match.tl (expand-quasi-match): Add case fo r unbound var followed by var, followed by nothing. * tests/011/patmatch.tl: New tests.
* matcher: use @(as) capture.Kaz Kylheku2021-04-251-4/+5
| | | | | | * share/txr/stdlib/match.tl (expand-quasi-match): Instead of accessing args with car and cadr, capture that part in the match using @(as) and refer to the variable.
* matcher: second round of quasi tests and fixes.Kaz Kylheku2021-04-251-5/+9
| | | | | | | * share/txr/stdlib/match.tl (expan-quasi-match): Use rest variable consistently instead of (cdr args). Two instances of (cdr rest) should just be rest. New case added for variable with no modifiers followed by text being the last item.
* matcher: first round of quasi tests and bugfix.Kaz Kylheku2021-04-251-7/+5
| | | | | | | | | | * share/txr/stdlib/match.tl (expand-quasi-match): The return value of search-str isn't a length but an absolute position. We not only fix a bug, but lose a useless calculation. * tests/011/patmatch.tl: New test cases for quasiliteral patterns, starting with the most rudimentary. Last one broke, due to the above issue.
* matcher: recognize sys:quasi in necessary places.Kaz Kylheku2021-04-251-7/+7
| | | | | | | | | | | * match.tl (compile-cons-structure): Recognize quasi in the middle of cons structure and compile appropriately. (parse-lambda-match-clause): Recognize quasi in dot position properly. (check, check-end): Treat quasi as atom pattern. (pat-len): Recognize quasi in dotted position. (non-triv-pat-p): Handle quasi case. Any quasi containing elements that are lists is nontrivial.
* matcher: turn sys:quasi defmatch into built-in.Kaz Kylheku2021-04-251-36/+44
| | | | | | | | | | | | | | | This not only gets rid of the @ from @`...`, but allows the `` empty pattern `` to work. A bug is also fixed. * share/txr/stdlib/match.tl (compile-match): Recognize list headed by sys:quasi and feed to expand-quasi-match. (sys:quasi): defmatch removed. (expand-quasi-match): Function formed from sys:quasi defmatch. Instead of :form argument, we access *match-form*, like all the other internal functions. Instead of the :env parameter, we use the vars-list object. Using that object's exists method fixed a bug: failing to check for existing variables using boundp.
* matcher: new quasiliteral matching macro.Kaz Kylheku2021-04-241-0/+109
| | | | | | | | * share/txr/stdlib/match.tl (sys:quasi): New defmatch. This is a macro for now, which makes it require the @ prefix: e.g. @`@a-@b-@c`. The plain is to integrate this into the matcher to eliminate that @ prefix. The first priority are test cases and documentation.
* compiler: optimize zero and one item quasiliterals.Kaz Kylheku2021-04-241-1/+4
| | | | | | | | | | | * share/txr/stdlib/compiler.tl (expand-quasi): Do not emit sys:fmt-join call unconditionally. If expand-quasi yields a list of one expression, we can just yield that expression. If the list is empty, we can yield a mutable empty string. (That case will not arise via `` because that converts to "" at read time, but code that generates quasiliteral syntax might have an empty case, and expect a mutable string in all cases).
* Version 257txr-257Kaz Kylheku2021-04-232-3/+3
| | | | | | | | | | | | | | | | | 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.
* 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.