summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
...
* doc: missing word in close-lazy-streams.Kaz Kylheku2024-04-061-3/+4
| | | | | * txr.1: Fix "stream is recorded in a hidden." and revise some neighboring text for clarity.
* doc: command-get-buf syntax.Kaz Kylheku2024-04-041-1/+1
| | | | | * txr.1: Fix bad formatting in syntax synopsis of command-get-buf.
* New functions for filtering through external processes.Kaz Kylheku2024-04-041-0/+115
| | | | | | | | | | | | | | * stdlib/getput.tl (sys:maproc-common): new function. (map-command-lines, map-command-str, map-command-buf, map-process-lines, map-process-str, map-process-buf): New functions. * autoload.c (getput_set_entries): Trigger autoload of getput module on new function symbols. * tests/018/getput.tl: New tests. * txr.1: Documented.
* New function: lcons-force.Kaz Kylheku2024-04-041-0/+32
| | | | | | | | * lib.[ch] (lcons_force): New function. * eval.c (eval_init): Register lcons-force intrinsic. * txr.1: Documented.
* Version 294.txr-294Kaz Kylheku2024-03-171-3/+3
| | | | | | | | | | | | | | * 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: Regenerated.
* window-map: condense with seq_iter and seq_build.Kaz Kylheku2024-03-091-9/+8
| | | | | | | | | | | * lib.c (window_map_common): New static function formed from window_map_list. (window_map_list, window_map_vec): Function removed. (window_map, window_mappend, window_mapdo): Simplify to wrappers around window_map_common. * txr.1: Some wording improved in the window-map documentation.
* doc: bad syntax under load-for.Kaz Kylheku2024-03-081-1/+1
| | | | * txr.1: fix incorrect markup.
* tests: suppress warnings in seq.tl.Kaz Kylheku2024-03-081-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When tests/012/compile.tl compiles tests/012/seq.tl, there are now some compiler warnings due to constant expressions that throw. We introduce a new compiler option to suppress them, and then use it. * stdlib/comp-opts.tl: New file. The definitions related to compiler options are moved here out of compile.tl, so that optimize.tl can use them. * stdlib/compiler.tl (compile-opts, %warning-syms%, when-opt, *compile-opts*, opt-controlled-diag): Moved to comp-opts.tl. New constant-throws option added to compile-opts and %warning-syms%. (safe-constantp): Make the constant expression throws diagnostic conditional on the new option. * stdlib/optimize.tl: Load comp-opts file. (basic-blocks do-peephole-block): Make diagnostic about throwing situation subject to constant-throws option. * tests/012/seq.tl: Turn off constant-throws warning option before the ref tests that work with ranges. Fix: one of the expressions calls refs with the wrong number of arguments, which was unintentional. * txr.1: Document new diagnostic option.
* doc: improvements in dwim and call documentationKaz Kylheku2024-03-071-4/+18
| | | | | | | | | | | * txr.1: Under call function, document that callable objects need not be functions; the dwim operator description has the details. Fix a formatting problem in the dwim operator syntax synopsis. Under dwim, clarify in more detail that the behavior for various objects are a consequence of their function calling semantics, rather than inherent in the dwim operator.
* New function: rangeref.Kaz Kylheku2024-03-071-4/+81
| | | | | | | | | | | | | | | | | | | | | Because ranges can be iterated like sequences, and are identified as vector-like, they have to support indexing. However, ranges already have semantics as a function: with a sequence argument, they slice it. Let's put the semantics into a function called rangeref, so it can be coherently documented. * eval.c (eval_init): Register rangeref intrinsic. * lib.c (generic_funcall): Range as a function works in terms of rangeref. (ref): Handle RNG case via rangeref. (rangeref): New function. * lib.h (rangeref): Declared. * tests/012/seq.tl: New tests.
* doc: replace "index-list" with "index-seq".Kaz Kylheku2024-02-291-57/+60
| | | | | | | | * txr.1: All arguments that give a list of indices into a sequence are called index-seq, because they are not required to be lists. Only the COMPATIBILITY section refers to index-list arguments, mentioning that those arguments are now called index-seq.
* partition, split, split*: iter used for indicesKaz Kylheku2024-02-291-27/+29
| | | | | | | | | | | | | | | | | | * lib.c (partition_func, split_func, split_star_func): Indices passed through lazy cons are now iterator, rather than a sequence accessed via car and cdr, which is inefficient for nonlists. (partition-split-common): Use iter-begin to convert indices to iterator, which becomes the cdr field of the lazy cons. * txr.1: Update documentation for these functions to clarify that the second argument is a sequence. The inaccurate text claiming that "if the second argument is an atom other than a function" is rewritten. This doesn't describe the behavior that is implemented, where the test applied is seqp, not atom. The indices can be a vector of integers, which is an atom.
* doc: add rationale about let vs let*.Kaz Kylheku2024-02-221-0/+22
| | | | | | * txr.1: Add Rationale: section to let and let* clarifying that the decision to make let parallel is for compatibility with other dialects like ANSI CL and Elisp.
* doc: fixes under macroexpand-params.Kaz Kylheku2024-02-151-17/+17
| | | | | * txr.1: Fix typo: for -> form; add missing leading indentation in example.
* New function: cons-count.Kaz Kylheku2024-02-091-0/+41
| | | | | | | | | | | | | * eval.c (eval_init): Register cons-count intrinsic. * lib.c (cons_count_rec): New static function. (cons_count): New function. * lib.h (cons_count): Declared. * tests/012/cons.tl: New tests. * txr.1: Documented.
* New function: cons-find.Kaz Kylheku2024-02-091-10/+38
| | | | | | | | | | | | | | | | | * eval.c (cons_find): Static function removed; a new one is implemented in lib.c. (eval_init): Register cons-find intrinsic. * lib.c (cons_find_rec): New static function. (cons_find): New function. * lib.h (cons_find): Declared. * tests/012/cons.tl: New file. * txr.1: Documented cons-find together with tree-find. Document that tree-find's test-fun argument is optional, defaulting to equal.
* match: remove bad restriction from @(sme) and @(end).Kaz Kylheku2024-02-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | The end pattern in @(sme) and @(end) does not have to be a list pattern, dotted or otherwise. It should support any pattern whatsoever for a single object, which should match the terminating atom. The documentation says that, though not very clearly; it is reworded also. * stdlib/match.tl (check-end): Remove this function, since the end pattern can be any pattern. (pat-len): Bugfix: we are using the meq function incorrectly. The object being compared against several alternatives must be the leftmost argument of meq. This bug prevents a pattern like @(evenp @x) to be correctly considered of length zero. (sme, end): Remove calls to check-end, and just refer to original end variable. * tests/011/patmatch.tl: New tests. * txr.1: clarify that the end pattern may be any pattern, which can match just the terminating atom or a possibly dotted suffix.
* compiler: implement inlining for chain expressions.Kaz Kylheku2024-02-071-1/+6
| | | | | | | | | | | | | | | | | | | | The opip syntax and its variants transforms into chain expressions. Currently, we emit actual chain function calls, and so all the chain arguments that are lambda expressions have become closures. In this commit, an inlining optimization is introduced which turns some chain function calls into chained expressions. The lambdas are then immediately called, and so succumb to the lambda-eliminating optimization. * stdlib/compiler.tl (compiler comp-fun-form): Handle chain forms. At optimization level 6 or higher, if the form is eligible for the transform, perform it. (inline-chain-rec, can-inline-chain, inline-chain): New functions. * txr.1: Mention that *opt-level* 6 does this chain optimization.
* doc: missing plural.Kaz Kylheku2024-02-041-1/+1
| | | | | * txr.1: Under Pattern-Matching Notation: subject-verb agreement.
* New function: hist-sort-by.Kaz Kylheku2024-02-021-1/+25
| | | | | | | | | | | | | * eval.c (eval_init): Register hist-sort-by intrinsic. * lib.c (hist_sort_by): New function. (hist_sort): Wrapper for hist_sort_by now. * lib.h (hist_sort_by): Declared. * tests/012/sort.tl: Tests. * txr.1: Documented.
* We need a length-< special method.Kaz Kylheku2024-01-191-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Structure objects can be used to implement lazy structures such as sequences. It is undesirable to take the length of a lazy sequence because it forces all of its elements to exist. Moreover, if the sequence is infinite, it is impossible. There are situations in which it is only necessary to know whether the length is less than a certain bound, and for that we have the length-< function. That works on infinite sequence such as lazy lists, requiring them to be forced only so far as to determine the truth value of the test. We need objects that implement lazy sequences to work with this function. * struct.h (enum special_slot): New member length_lt_m. * lib.h (length_lt_s): Symbol variable declared. * struct.c (special_sym): New entry in this table, associating the length_lt_m enum with the length_lt_s symbol variable. * lib.c (length_lt_s): Symbol variable defined. (length_lt): Handle COBJ objects that are structures. we test whether they have a length-< method, or else length method. If they don't have either, we throw. We don't fall back on the default case for objects that don't have a length-< method, because the diagnostic won't be good if they don't have a length method either; the programmer will be informed that the length function couldn't find a length method, without mentioning that it was actually length-< that is being used. * eval.c (eval_init): Register length-< using the length_lt_s symbol variable rather than using intern. * txr.1: Documented. * tests/012/oop-seq.tl: New tests.
* doc: mmap: document source parameter.Kaz Kylheku2024-01-181-0/+34
| | | | | | * txr.1: The source argument of mmap is not adequately documented. It can be an integer descriptor, stream or filename string.
* Copyright year bump 2024.Kaz Kylheku2024-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * LICENSE, LICENSE-CYG, METALICENSE, Makefile, alloca.h, args.c, args.h, arith.c, arith.h, autoload.c, autoload.h, buf.c, buf.h, cadr.c, cadr.h, chksum.c, chksum.h, chksums/crc32.c, chksums/crc32.h, combi.c, combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c, ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h, gzio.c, gzio.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c, lib.h, linenoise/linenoise.c, linenoise/linenoise.h, match.c, match.h, parser.c, parser.h, parser.l, parser.y, psquare.h, rand.c, rand.h, regex.c, regex.h, signal.c, signal.h, socket.c, socket.h, stdlib/arith-each.tl, stdlib/asm.tl, stdlib/awk.tl, stdlib/build.tl, stdlib/cadr.tl, stdlib/compiler.tl, stdlib/constfun.tl, stdlib/conv.tl, stdlib/copy-file.tl, stdlib/csort.tl, stdlib/debugger.tl, stdlib/defset.tl, stdlib/doloop.tl, stdlib/each-prod.tl, stdlib/error.tl, stdlib/except.tl, stdlib/expander-let.tl, stdlib/ffi.tl, stdlib/getopts.tl, stdlib/getput.tl, stdlib/glob.tl, stdlib/hash.tl, stdlib/ifa.tl, stdlib/keyparams.tl, stdlib/load-args.tl, stdlib/match.tl, stdlib/op.tl, stdlib/optimize.tl, stdlib/package.tl, stdlib/param.tl, stdlib/path-test.tl, stdlib/pic.tl, stdlib/place.tl, stdlib/pmac.tl, stdlib/quips.tl, stdlib/save-exe.tl, stdlib/socket.tl, stdlib/stream-wrap.tl, stdlib/struct.tl, stdlib/tagbody.tl, stdlib/termios.tl, stdlib/trace.tl, stdlib/txr-case.tl, stdlib/type.tl, stdlib/vm-param.tl, stdlib/with-resources.tl, stdlib/with-stream.tl, stdlib/yield.tl, stream.c, stream.h, struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h, syslog.c, syslog.h, termios.c, termios.h, time.c, time.h, tree.c, tree.h, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c, vm.h, vmop.h, win/cleansvg.txr, y.tab.c.shipped: Copyright year bumped to 2024.
* doc: formatting under compiler-let.Kaz Kylheku2024-01-041-1/+1
| | | | * txr.1: Fix markup of syntax, invalid due to missing space.
* doc: clarification regarding sort stability.Kaz Kylheku2024-01-031-1/+3
| | | | | * txr.1: Clarify that both sort and nsort are not stable for vectors and strings.
* Version 293.txr-293Kaz Kylheku2023-12-281-3/+3
| | | | | | | | | | | | * RELNOTES: Updated. * configure (txr_ver): Bumped version. * stdlib/ver.tl (lib-version): Bumped. * txr.1: Bumped version and date. * txr.vim, tl.vim: Regenerated.
* doc: fix comb reference under rcomb.Kaz Kylheku2023-12-271-1/+1
| | | | | * txr.1: Section describing rcomb function wrongly refers to comb.
* doc: in Math Library mention User-Defined ArithmeticKaz Kylheku2023-12-201-0/+28
| | | | | | | | | * txr.1: The Math Library is documented in a way that is oblivious to User-Defined Arithmetic. This is now clarified. When some of the argument types of a math function are user-defined arithmetic structures, the stated conversions and restrictions don't apply, since it defers all semantics to the method invoked.
* json: support Lisp comments.Kaz Kylheku2023-12-201-0/+13
| | | | | | | | | | | | | | | I've run into situations in which I wanted a comment in a big JSON quasiliteral to explain some embedded piece of code. We support only semicolon comments, and no #; ignore notation. * parser.l (grammar): Recognize Lisp comments in the JSON state also. That does it. * tests/010/json.tl: One modest little test. * txr.1: Documented. * lex.yy.c.shipped: Regenerated.
* New functions: read-objects, file-get-objects, ...Kaz Kylheku2023-12-191-2/+73
| | | | | | | | | | | | | | | | | | | | | | * parser.c (read_objects_common): New static function, formed from read_objects_from-string. (read_objects_from_string): Now wrapper for read_objects_common. (read_objects): New function. * parser.h (read_objects): Declared. * eval.c (eval_init): Register read-objects intrinsic. * autoload.c (getput_set_entries): Add three new symbols: file-get-objects, file-put-objects and file-append-objects. * stdlib/getput.tl (put-objects): New system function. (file-get-objects, file-put-objects, file-append-objects): New functions. * txr.1: Documented. * tests/018/getput.tl: New file.
* hash: new function, hash-join.Kaz Kylheku2023-12-181-0/+42
| | | | | | | | | | | * hash.c (hash_join): New function. (hash_init): hash-join intrinsic registered. * hash.h (hash_join): Declared. * tests/010/hash.tl: New tests. * txr.1: Documented.
* hash: test cases and small doc fix.Kaz Kylheku2023-12-181-1/+4
| | | | | | | * tests/010/hash.tl: Add test cases for the hash set operations. * txr.1: Clarify that in hash-uni, the mapping functions are used on all items, not just ones subject to joinfun.
* load: load block value should be exit status.Kaz Kylheku2023-12-111-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When TXR executes a top-level program, such that it will exit when the last form in that program terminates, it simulates a load. There is a block named load visible, and the program can evaluate a (return-from load <expr>). The value of that <expr> is thrown away, and the termination status is always unsuccessful. In this patch, (return-from load <expr>) is made to work such that the value of <expr> will determine the exit status, according to the same interpretation that (exit <expr>) would give to the value. * sysif.[ch] (exit_wrap): Static function becomes external. * txr.c (txr_main): In the cases where we execute a file and return from main, we now call exit_wrap instead. The termination status is not simply based on whether the file was successfully read, but takes into account the load block. * tests/019/load-ret/{script.tl,bad.tl}: New files. * tests/019/load-ret/load-ret.tl: New tests. * txr.1: Documented.
* doc: fix "an" typos.Kaz Kylheku2023-12-031-13/+13
| | | | | * txr.1: Fix numerous "an" articles that should be "a", as well as one case of "and" missing a "d".
* doc: quasiquote: note about special quote splice.Kaz Kylheku2023-12-031-0/+44
| | | | | | | | * txr.1: Add dialect note about TXR supporting ,',*args whereby multiple items get spliced into a quote, which effectively distributes into multiple quotes. The direct equivalent does not work in all Common Lisp implementations, and doesn't appear to be required by the standard.
* doc: typo under rlink.Kaz Kylheku2023-11-251-1/+1
| | | | * txr.1: fix transposition: "ot" -> "to".
* sh-esc: clean up mess I made.Kaz Kylheku2023-11-251-15/+19
| | | | | | | | | | | | | | | | | | | | | | Not all special characters can just be backslash escaped. Spaces and newlines must be quoted. * stream.c (sh_esc_common): New function. Handles both sh-esc and sh-esc-all logic, distinguished by a flag. Quoting is used, rather than backslash escaping. If the string contains no special characters, it is just erturned. If it can be double quoted, it is double quoted. Otherwise it is single quoted and any contained single quotes are replaced by '\''. (sh_esc, sh_esc_all): Now just wrap sh_esc_common. (sh_esc_dq): Remove the newline from the set of escaped characters. Escaping a newline generates a continuation sequence which eats the newline. * tests/018/sh-esc.tl: Most test cases deleted; many new test cases added. * txr.1: Documentation revised.
* Version 292.txr-292Kaz Kylheku2023-11-201-3/+3
| | | | | | | | | | | | | | * 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: Regenerated.
* time: bug: must subtract gmtoff, not add.Kaz Kylheku2023-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This works fine: 1> (time-struct-utc 0) #S(time year 1970 month 1 day 1 hour 0 min 0 sec 0 wday 4 yday 0 dst nil gmtoff 0 zone "GMT") 2> *1.(time-utc) 0 3> *1.(time-local) 28800 But we want the following to return the same results: 1> (time-struct-local 0) #S(time year 1969 month 12 day 31 hour 16 min 0 sec 0 wday 3 yday 364 dst nil gmtoff -28800 zone "PST") 2> *1.(time-utc) -57600 3> *1.(time-local) -28800 With the patch, we do: 1> (time-struct-local 0) #S(time year 1969 month 12 day 31 hour 16 min 0 sec 0 wday 3 yday 364 dst nil gmtoff -28800 zone "PST") 2> *1.(time-utc) 0 3> *1.(time-local) 28800 This is also broken: 1> (time-parse-utc "%H:%M:%z" "00:00:-0800") -28800 It must return 28800. * time.c (time_meth): This function, which is the imlpementation of the time-utc and time-local methods, must subtract the gmtoff field, not add it. This is so that a UTC time expressed in a local time zone will convert back to the correct UTC epoch. (time_parse_local, time_parse_utc): Here we likewise must subtract the gmtoff.
* doc: incorrect description of rlink.Kaz Kylheku2023-11-151-3/+7
| | | | | * txr.1: The rlink function resolves the target path if it is a symlink, not the new link's path.
* doc: fix wrong typesetting of nil and t.Kaz Kylheku2023-11-151-13/+13
| | | | | | | | * txr.1: Fix numerous occurrences of nil and t being typeset using "meta" rather than "code". That makes them slanted in the HTML and PDF, and appear in angle brackets as <nil> and <t> in text-based man output. We want a non-slanted type, and no angle brackets for these.
* oop: allow del on struct sequences.Kaz Kylheku2023-11-151-0/+53
| | | | | | | | | | * lib.c (dwim_del): Remove check against structures from OBJ case; we just let this pass through to the logic that invokes replace. * tests/012/aseq.tl: New test cases. * txr.1: Document how del works on a [obj index] place.
* New accessor: mref.Kaz Kylheku2023-11-151-0/+137
| | | | | | | | | | | | | | * eval.c (eval_init): Register mref intrinsic. * lib.[ch] (mref): New function. * stdlib/place.tl (sys:mref1): New place. (mref): New place macro, defined in terms of sys:merf1, ref place and mref function. * tests/012/seq.tl: New tests. * txr.1: Documented.
* ref: bugfix in deletion of ref place.Kaz Kylheku2023-11-111-78/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ref function is not defined in the documentation as an accessor, but there is a ref place. Unfortunately, deletion is broken: (del (ref x y)) does not store the new sequence back into place x, and so it does not work correctly for lists; if x is a list, it doesn't change. Various accessors are defined in terms of ref, as place macros, such as the first, second, third, ... accessors. This fixes the bug for them also; (del (second list)) must update list. * stdlib/place.tl (ref): Fix the delete-expander to fetch the clobber expander of the sequence place, and use the simple setter to put the edited sequence into that place. * tests/012/seq.tl: Test case, which breaks without this fix. Test the (second ...) place also, which is defined in terms of ref. * txr.1: Split documentation for ref and refset, mainly because one is an Accessor and one is a Function. Removing some discussions about the equivalences between DWIM brackets and ref; there are subtleties there not worth going into. Description of refset is simplified. We mention the possibility of del over a ref place; only in that case is the sequence itself required to be a place.
* New macro: tap.Kaz Kylheku2023-11-081-0/+66
| | | | | | | | | | | * autoload.c (op_set_entries): Add tap symbol as autoload trigger for op module. * stdlib/op.tl (tap): New macro. * tests/012/op.tl: New test. * txr.1: Documented.
* match: translate some match-case forms into casequal.Kaz Kylheku2023-10-221-12/+59
| | | | | | | | | | | | | | | | | | | The motivation here is that casequal brings in some optimizations not done by match-case, like hashed lookup and jump tables. * stdlib/match.tl (non-triv-pat-t): Move temporary definition higher in file since it is needed earlier in the bootsrapping. (match-case-to-casequal): New function. (match-case): Try converting clauses to casequal with new function. If that returns something, use that as the expansion, otherwise perform the normal expansion. * txr.1: Documentation revised. Existing text is wrong which says that the clauses of a caseq, caseql or casequal are always evaluated sequentially. Furthermore, now that match-case and match-ecase can be transformed to casequal, they also don't necessarily evaluate sequentially. We spell out the conditions under which they may translate.
* New: length-list-<, length-<Kaz Kylheku2023-10-051-0/+86
| | | | | | | | | | | | | | | | | | | | | | These are functions for testing whether a list or sequence is shorter than a given integer. This is cheaper than calculating the length of lists, which is in some cases impossible if they are infinite. A length-str-< function already exists, useful with lazy strings. length-< uses length-list-< or length-str-< as appropriate * lib.[ch] (length_list_lt, length_lt): New functions. * eval.c (eval_init): length-list-< and length-< intrinsics registered. * tests/012/seq.tl: New tests. * txr.1: Documented.
* doc: small omission in flatcar.Kaz Kylheku2023-10-051-0/+4
| | | | | * txr.1: Document that flatcar and flatcar* accept an atom argument, which is returned.
* flatten*: fix two bugs.Kaz Kylheku2023-09-301-9/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | * lib.c (lazy_flatten_scan): Fix a problem which results in cases like (()), ((())) ... to incorrectly flatten to (nil). The do loop in this function which iteratively descends into a nested left-nesting of a list does not handle all cases, and therefore the function may not return at that point. Removing the return fixes the problem, but so does removing the loop so that in that case we just descend one level into the nested list, and continue in the main loop. What is incorrect is that when the consp(a) test fails and the do loop terminates, we need to distinguish the cases off a being an atom versus nil. Continuing in the loop does that. This bug was spotted by a reviewer in the comp.lang.c Usenet newsgroup. (lazy_flatten): We neglect to handle the case here that the input is an empty list, resulting in (flatten* nil) returning (nil) rather than nil. The flatten function is correct. * tests/012/seq.tl: New tests. * txr.1: Documentation improved. In particular, these functions don't handle improper lists. Also, it needs to be documented that the argument may be an atom.
* Integration with setjmp/longjmp.Kaz Kylheku2023-09-271-0/+190
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Defining libpng bindings, with longjmp catching, is now possible. * autoload.c (ffi_set_entries): Add setjmp symbol, which is a new macro in stdlib/ffi.tl. * ffi.c (jmp_buf_s): New symbol variable. (mk_jmp_buf, rt_setjmp, longjmp_wrap): New functions. (ffi_init): Initialize jmp_buf_s. Register sys:rt-setjmp and longjmp intrinsics. * ffi.h (jmp_buf_s): Declared. * stdlib/ffi.h (setjmp): New macro. Rather than introducing a new special operator, we use a run-time support function called sys:rt-setjmp, which takes functional arguments. * unwind.[ch] (uw_snapshot, uw_restore): New functions. The rt_setjmp function needs these to restore our unwind frame stack into a sane state after catching a longjmp, which bails without unwinding it, leaving the pointers referring to frames that no longer exist. * tests/017/setjmp.tl, * tests/017/setjmp.expected: New files. * txr.1: Documented.