summaryrefslogtreecommitdiffstats
path: root/stdlib/doc-syms.tl
Commit message (Collapse)AuthorAgeFilesLines
* doc: document *struct-clause-expander*.Kaz Kylheku2021-12-271-0/+1
| | | | | | | * txr.1: New section about special variable *struct-clause-expander*. * stdlib/doc-syms.tl: Updated.
* new feature: :mass-delegate struct clause macro.Kaz Kylheku2021-12-231-0/+1
| | | | | | | | | | | | | | | With :mass-delegate, it is possible to generate delegation methods in bulk. All of the methods of a struct type can be mirrored by delegates in another struct type just by writing a single :mass-delegate clause. * stdlib/struct.tlk (:mass-delegate): New struct clause macro. * tests/012/oop.tl: New tests. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* new feature: defstruct clause macros.Kaz Kylheku2021-12-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | * lisplib.c (struct_set_entries): Trigger autoload on new symbols define-struct-clause and *struct-clause-expander*. * stdlib/struct.tl (*struct-clause-expander*): New variable. (defstruct): expand-slot local function now returns list of expanded slots, not a single slot; every case in the tree-case is converted to return a list. The syntax of a slot clause is first expanded through *struct-clause-expander hash; if that works then the resulting list is further scanned for expansions. (define-struct-clause): New macro. (:delegate): New struct clause defined with define-struct-clause. Provides single-slot delegation. * tests/012/oop.tl: Tests for :delegate. * txr.1: Documented define-struct-clause and :delegate. * stdlib/doc-syms.tl: Updated.
* The pairlis function comes to TXR Lisp.Kaz Kylheku2021-12-221-0/+1
| | | | | | | | | | | | * eval.c (eval_init): Register pairlis intrinsic. * lib.c, lib.h (pairlis): New function. * tests/012/seq.tl: New test cases. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* New functions: subq, subql, subqual and subst.Kaz Kylheku2021-12-221-0/+4
| | | | | | | | | | | | | | | * eval.c (eval_init): Register new intrinsics. * lib.c, lib.h (subq, subql, subqual, subst): New functions. * tests/012/seq.tl: New test cases. * stdlib/optimize.tl (subst): Function removed. The new subst drop-in replaces this one. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* tree: new functions for priority queue operation.Kaz Kylheku2021-12-181-0/+4
| | | | | | | | | | | | | | | | * tree.c (tree_min_node, tree_min, tree_del_min_node, tree_del_min): New functions. (tree_init): tree-min-node, tree-min, tree-del-min-node, tree-del-min: New intrinsics registered. * tree.h (tree_min_node, tree_min, tree_del_min_node, tree_del_min): Declared. * txr.1: Documented. * tests/010/tree.tl: New tests. * stdlib/doc-syms.tl: Updated.
* tree: support for duplicate keys.Kaz Kylheku2021-12-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tree.c (tr_insert): New argument for allowing duplicate. If it is true, suppresses the case of replacing a node, causing the logic to fall through to traversing right, so the duplicate key effectively looks like it is greater than the existing duplicates, and gets inserted as the rightmost duplicate. (tr_do_delete_specific, tr_delete_specific): New static functions. (tree_insert_node): New parameter, passed to tr_insert. (tree_insert): New parameter, passed to tree_insert_node. (tree_delete_specific_node): New function. (tree): New parameter to allow duplicate keys in the elements sequence. (tree_construct): Pass t to tree to allow duplicate elements. (tree_init): Update registrations of tree, tree-insert and tree-insert-node. Register tree-delete-specific-node function. * tree.h (tree, tree_insert_node, tree_insert): Declarations updated. (tree_delete_specific_node): Declared. * lib.c (seq): Pass t argument to tree_insert, allowing duplicates. * parser.c (circ_backpatch): Likewise. * parser.y (tree): Pass t to new argument of tree, so duplicates are preserved in the element list of the #T literal. * y.tab.c.shipped: Updated. * tests/010/tree.tl: Test cases for duplicate keys. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* rot, nrot: new functions.Kaz Kylheku2021-12-071-0/+2
| | | | | | | | | | | | | | * eval.c (eval_init): nrot, rot intrinsics registered. * lib.c (nrot, rot): New functions. * lib.h (nrot, rot): Declared. * tests/012/seq.tl: New test cases. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* tuples*: new function.Kaz Kylheku2021-12-041-0/+1
| | | | | | | | | | | | | | | * eval.c (eval_init): Register tuples* intrinsic. * lib.c (tuples_star_func): New static function. (tuples_star): New function. * lib.h (tuples_star): Declared. * tests/012/seq.tl: New test cases. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* doc: spelling, doc-syms refresh.Kaz Kylheku2021-11-031-2/+2
| | | | | | | | * txr.1: Fix spelling errors that have crept in due to read-once and the quasiliteral fixes to matching. * stdlib/doc-syms.tl: Forgotten refresh, needed by the fix to the wrong random-float-inc name.
* places: new accessor read-once.Kaz Kylheku2021-10-261-0/+1
| | | | | | | | | | | * lisplib.c (place_set_entries): Trigger autoload on read-once. * stdlib/place.t (read-once): New function and place. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* random: new function random-float-incl.Kaz Kylheku2021-10-251-1/+2
| | | | | | | | | | | | This function includes the 1.0 value excluded by random-float. * rand.c (random_float_incl): New static function. (rand_init): Register random_float_incl intrinsic. * txr.1: Document, and add discussion about uniformity requirements and what they mean and do not mean. * stdlib/doc-syms.tl: Updated.
* doc: doc-syms refresh.Kaz Kylheku2021-10-181-0/+1
| | | | * stdlib/doc-syms.tl: Updated.
* ffi: add cptr-carray function.Paul A. Patience2021-10-021-0/+1
| | | | | | | | | | | * ffi.c (cptr_carray): New function. (ffi_init): Register cptr-carray intrinsic. * ffi.h (cptr_carray): Declared. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* New variable: *child-env*.Kaz Kylheku2021-09-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This specifies the environment to be used for executing programs. * stream.c (open_subprocess, run): Check *child-env* variable and if other than t, then install the environment before execvp. In the spawn-based version of run, we save and restore the environment around the spawn call, if *child-env* is in effect. * sysif.c (child_env_s): New symbol variable. (exec_wrap): If *child-env* is other than t, then save the environment in a list, and install the specified environment before calling execvp. If that function returns, restore the environbment. * sysif.h (child_env_s): Declared. (child_env): New macro. * tests/018/process.tl: New tests. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* New function: replace-env.Kaz Kylheku2021-09-251-0/+1
| | | | | | | | | | | | | | | | | | | Using this new function together with env, it's now possible to save the set of environment variables, clobber it to a specified set (possibly empty) and then restore it. Useful for improved security in running child processes. * lib.[ch] (chk_substrdup_utf8): New function. * sysif.c (replace_env): New function. (sysif_init): Register replace-env intrinsic. * sysif.h (replace_env): Declared. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* New variants of each operator for sum and product.Kaz Kylheku2021-09-231-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | * lisplib.c (arith_each_instantiate, arith_each_set_entries): New functions. (each_prod_set_entries): Add sum-each-prod, sum-each-prod*, mul-each-prod and mul-each-prod* as autoload triggers for each-prod.tl, where those macros are now defined. (lisplib_init): Register autoloading of arith-each.tl via the two new functions. * stdlib/arith-each.tl: New file. * stdlib/each-prod.tl (sys:expand-each-prod*): Handle sum-each-prod* and mul-each-prod* in the same way, by mapping to their parallel binding counterparts. (sys:expand-arith-each-prod): New function. (sym-each-prod, mul-each-prod, sum-each-prod*, mul-each-prod*): New macros. * tests/016/arith.tl: New tests. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* math: quantile estimator using P-Squared algorithm.Kaz Kylheku2021-09-221-0/+1
| | | | | | | | | | | | | | | | | | | * Makefile (psquare.o): New object file. * arith.c (psq_ops): New static structure. (quant_fun): New static function. (quantile): New function. (arith_init): Register quantile intrinsic. * arith.h (quantile): Declared. * psquare.c, psquare.h: New files. * tests/016/arith.tl: New tests. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* defset: add set-mask and clear-mask.Paul A. Patience2021-09-141-0/+2
| | | | | | | | | | | | | | | | | | | | * stdlib/defset.tl (set-mask, clear-mask): New update macros. * stdlib/optimize.tl (calc-liveness): Use the new macros. * stdlib/socket.tl (sys:str-inaddr-net-impl, str-in6addr-net): Same. * stdlib/termios.tl (set-iflags, set-oflags, set-cflags, set-lflags, clear-iflags, clear-oflags, clear-cflags, clear-lflags): Same. * lisplib.c (defset_set_entries): Add set-mask and clear-mask to autoload symbols for defset. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* ffi, sockets: add sock-opt and sock-set-opt.Paul A. Patience2021-09-121-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new sock-opt and sock-set-opt functions are wrappers around getsockopt and setsockopt, respectively. All POSIX socket options are registered. Platform-specific options may be added in the future. * ffi.c (sock_opt, sock_set_opt): New functions. (ffi_init): Register sock-opt, sock-set-opt, sol-socket, ipproto-ip, ipproto-ipv6, ipproto-tcp, ipproto-udp, so-acceptconn, so-broadcast, so-debug, so-dontroute, so-error, so-keepalive, so-linger, so-oobinline, so-rcvbuf, so-rcvlowat, so-rcvtimeo, so-reuseaddr, so-sndbuf, so-sndlowat, so-sndtimeo, so-type, ipv6-join-group, ipv6-leave-group, ipv6-multicast-hops, ipv6-multicast-if, ipv6-multicast-loop, ipv6-unicast-hops, ipv6-v6only, tcp-nodelay. * lisplib.c (sock_set_entries): Add sock-opt and sock-set-opt. * stdlib/socket.tl (sock-opt): Define as syntactic place. * tests/014/socket-misc.tl: New cases, for sock-opt. (set-and-get): New macro. * txr.1: Documented. Also, mention that sock-bind enables so-reuseaddr. * stdlib/doc-syms.tl: Updated.
* exceptions: hack to store errno in string object.Kaz Kylheku2021-09-071-12/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Basic idea: when we throw an exception that pertains to a system error which has an errno code, we can stick the errno into the memory area of the character string, into the wchar_t that immediately follows the null terminator. We can do this because strings track their actual allocation size. A pair of setter/getter functions to set and retrieve this value are provided, and all functions in the code which can set such a code are updated to do so, simply by calling the newly added uw_ethrowf that drop-in replaces for uw_throwf. * lib.[ch] (string_set_code, string_get_code): New functions. * unwind.[ch] (uw_ethrowf): New function. * eval.c (eval_init): Register string-set-code and string-get-code intrinsics. * ftw.c (ftw_wrap): Switch to uw_ethrowf. * parser.c (open_txr_file): Likewise. * socket.c (dgram_overflow): Store the ENOBUFS error in errno, and use uw_ethrowf instead uw_throwf. (dgram_get_byte_callback, dgram_flush, sock_bind, to_connect, open_sockfd, sock_connect, sock_listen, sock_accept, sock_shutdown, sock_timeout, socketpair_wrap): Switch to uw_ethrowf. * stream.c (dev_null_get_fd, stdio_maybe_read_error, stdio_maybe_error, stdio_close, pipe_close, open_directory, open_file, open_fileno, open_tail, fds_subst, open_subprocess, open_command, remove_path, rename_path, tmpfile_wrap, mkdtemp_wrap, mkstemp_wrap): Switch to uw_ethrowf. * sysif.c (mkdir_wrap, ensure_dir, chdir_wrap, getcwd_wrap, rmdir_wrap, mknod_wrap, mkfifo_wrap, chmod_wrap, do_chown, symlink_wrap, link_wrap, readlink_wrap, close_wrap, val exec_wrap, stat_impl, do_utimes, pipe_wrap, poll_wrap, getgroups_wrap, setuid_wrap, seteuid_wrap, setgid_wrap, setegid_wrap, setgroups_wrap, getresuid_wrap, setresuid_wrap, setresgid_wrap, crypt_wrap, uname_wrap, opendir_wrap, getrlimit_wrap, setrlimit_wrap): Likewise. * termios.c (tcgetattr_wrap, tcsetattr_wrap, tcsendbreak_wrap, tcdrain_wrap, tcflush_wrap, tcflow_wrap): Likewise. * tests/018/errno.tl: New file. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* string-finish: new function.Kaz Kylheku2021-09-071-0/+1
| | | | | | | | | | | | * eval.c (eval_init): Register string-finish intrinsic. * lib.c (string_finish): New function. * lib.h (string_finish): Declared. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* ffi: add socklen-t type.Paul A. Patience2021-09-061-17/+18
| | | | | | | | | | * ffi.c: Include <sys/socket.h> if we HAVE_SOCKETS. (ffi_init_extra_types): Initialize socklen-t type if we HAVE_SOCKETS. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* load: new macros push-after-load and pop-after-load.Kaz Kylheku2021-09-031-0/+2
| | | | | | | | | | | | | * eval.c (me_push_after_load, me_pop_after_load): New static functions. (eval_init): Register push-after-load and pop-after-load intrinsic macros. * tests/019/load-hook.tl: Tests for correct expansion. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* New function: delcons.Kaz Kylheku2021-09-021-0/+1
| | | | | | | | | | | | * eval.c (eval_init): Register delcons intrinsic. * lib.[ch] (delcons): New function. * tests/010/cons.tl: New file. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* load: new *load-hooks* feature.Kaz Kylheku2021-09-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | *load-hooks* lets a .txr, .tl or .tlo file specify actions to be taken when the loading of that file completes, whether normally or via an exception. They are also honored by process exit. For instance, with this, we can have a Lisp file that behaves like a script which cleans up after itself (e.g. removing temporary files) even if it is not run as a stand-alone program, but invoked via (load ...). Because it's not a stand-alone program, it cannot simply use the at-exit-call mechanism. The unwind-protect operator could be used, but it's inconvenient because it protects a single form. The *load-hooks* feature in effect protects all the top level forms of a load, similarly to unwind-protect. Also, unwind-protect does not guard against a process exit. (However, *load-hooks* does not guard against an abnormal exit, only normal termination). * eval.c (load_hooks_s): New symbol variable. (run_load_hooks): New function. (run_load_hooks_atexit): New static function. (load): bind *load-hooks* to nil around load. Implement the hooks processing via run_load_hooks, taking care to pass the load-time dynamic environment that has already been undone. (eval_init): Initialize load_hooks_s and register the *load-hooks* variable. Register run_load_hooks_atexit with atexit, so the current value of *load-hooks* is processed on process exit. * eval.h (load_hooks_s, run_load_hooks): Declared. * match.c (v_load): Similar changes as in load. * txr.c (txr_main): Run the load hooks with run_load_hooks immediately after processing the .txr or .tl file, before entering the listener. * tests/019/load-hook.tl: New directory and file * tests/load-hook.tl: New file. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* rand: provide random-buf function.Kaz Kylheku2021-08-261-0/+1
| | | | | | | | | | | * rand.c (random_buf): New function. (rand-init): random-buf intrinsic registered. * rand.h (random_buf): Declared. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* ffi: provide mmap through carray.Kaz Kylheku2021-08-221-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure: configure test for mmap depositing HAVE_MMAP into config.h. * ffi.c (struct carray): Subject to HAVE_MMAP, new mm_len member which keeps track of the size of an underlying mapping so that we can unmap it, as well as peform operations like msync on it. (make_carray): Initialize mm_len to 0. (MAP_GROWSDOWN, MAP_LOCKED, MAP_NORESERVE, MAP_POPULATE, MAP_NONBLOCK, MAP_STACK, MAP_HUGETLB, MAP_SHARED, MAP_PRIVATE, MAP_FIXED, MAP_ANON, MAP_HUGE_SHIFT, MAP_HUGE_MASK, PROT_READ, PROT_WRITE, PROT_EXEC, PROT_NONE, PROT_GROWSDOWN, PROT_GROWSUP, MADV_NORMAL, MADV_RANDOM, MADV_SEQUENTIAL, MADV_WILLNEED, MADV_DONTNEED, MADV_FREE, MADV_REMOVE, MADV_DONTFORK, MADV_DOFORK, MADV_MERGEABLE, MADV_UNMERGEABLE, MADV_HUGEPAGE, MADV_NOHUGEPAGE, MADV_DONTDUMP, MADV_DODUMP, MADV_WIPEONFORK, MADV_KEEPONFORK, MADV_HWPOISON, MS_ASYNC, MS_SYNC, MS_INVALIDATE): #define as 0 if missing. (carray_munmap_op): New static function. (carray_mmap_ops): New static structure. (mmap_wrap, munmap_wrap): New functions. (mmap_op): New static function. (mprotect_wrap, madvise_wrap, msync_wrap): New functions. (ffi_init): Register mmap, munmap, mprotect, madvise and msync as well as numerous integer variables: map-growsdown, map-locked, map-noreserve, map-populate, map-nonblock, map-stack, map-hugetlb, map-shared, map-private, map-fixed, map-anon, map-huge-shift, map-huge-mask, prot-read, prot-write, prot-exec, prot-none, prot-growsdown, prot-growsup, madv-normal, madv-random, madv-sequential, madv-willneed, madv-dontneed, madv-free, madv-remove, madv-dontfork, madv-dofork, madv-mergeable, madv-unmergeable, madv-hugepage, madv-nohugepage, madv-dontdump, madv-dodump, madv-wipeonfork, madv-keeponfork, madv-hwpoison, ms-async, ms-sync, ms-invalidate, page-size. * ffi.h (mmap_wrap, munmap_wrap, mprotect_wrap madvise_wrap, msync_wrap): Declared. * tests/017/mmap.tl: New file. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* matcher: rename error-throwing macros.Kaz Kylheku2021-08-191-5/+5
| | | | | | | | | | | | | | | * stdlib/match.tl (must-match): Renamed to just match. It's just when-match without the "when". (must-match-case): Renamed to match-ecase, consistent with the case -> ecase naming scheme. * lisplib.c (match_set_entries): Names updated here. * tests/011/patmatch.tl: Test cases updated. * txr.1: Names updated here. * stdlib/doc-syms.tl: Updated.
* New ecase macros.Kaz Kylheku2021-08-181-0/+6
| | | | | | | | | | | | | | | | | | | | Even prior to discovering the recent defect in deffi, which was caused by a missing case in caseql, combined with poor testing, I was already thinking about adding ecase macros. The introduction of must-match and must-match-case also shows my motivation. That deffi bug convinced me to take action and implement these. * eval.c (case_error_s) New symbol variable. (me_ecase): New static function. (eval_init): Register new intrinsic macros ecaseq, ecaseql, ecasequal, ecaseq*, ecaseql* and ecasequal*. Intern case-error and initialize case_error_s. * txr.1: Documented. Also updated Exception Hierarchy diagram with match-error and case-error. * stdlib/doc-syms.tl: Updated.
* doc-syms: update.Kaz Kylheku2021-08-151-3/+5
|
* doc: improve.Paul A. Patience2021-08-141-2/+3
| | | | | | | | | | | | * RELNOTES: Fix various minor issues and stylistic issues. * configure: Remove repeated word and add missing word. * txr.1: Fix various minor, not-so-minor and stylistic issues. In particular, struct-from-args was misspelled in the .mets line and open-subprocess was missing from the .coNP line. * stdlib/doc-syms.tl: Updated.
* txr: @(eof) takes argument for binding termination status.Kaz Kylheku2021-08-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We extend the matching context structures to keep track of the underlying stream from which lines are being taken via the lazy list. Then the implementation of the @(eof) directive, when it hits the eof condition, can use this stream to gain access to the termination status. * match.c (match_line_ctx, match_files_ctx): New member, stream. (ml_all): Take stream argument and initialize new member. (h_call, do_match_line): Pass stream argument to h_call. (mf_all, mf_file_data): Take stream argument and initialize new member. (mf_from_ml): Propagate stream from line context to file context. (freeform_prepare, v_next_impl, match_filter, match_fun, extract): Pass stream argument where now needed. (v_eof): Implement termination status binding via the stream stored in the context. (open_data_source): Store stream in match files context. * tests/010/eof-status.txr: New file. * tests/010/eof-status.expected: New file. * Makefile (tst/tests/010/eof-status.ok): -B option for new test. * txr.1: Documented eof directive, argument and all. * stdlib/doc-syms.tl: Updated.
* doc: *read-bad-json* fix and doc-syms update.Kaz Kylheku2021-07-311-0/+1
| | | | | | * txr.1: Fix code -> codn. * stdlib/doc-syms.tl: Updated.
* New functions: getrlimit, setrlimit.Kaz Kylheku2021-07-131-0/+6
| | | | | | | | | | | | | | | | * stdlib/doc-syms.tl: Updated. * sysif.c (rlim_s, cur_s, max_s): New symbol variables. (rlim_st): New variable. (getrlimit_wrap, setrlimit_wrap): New functions. (sysif_init): gc-protect rlim-st. Initialize symbol vsariables. Create rlim struct type. Register getrlimit and setrlimit intrinsics. Register variables rlim-saved-max, rlim-saved-cur, rlim-infinity, rlimit-core, rlimit-cpu, rlimit-data, rlimit-fsize, rlimit-nofile, rlimit-stack and rlimit-as. * txr.1: Documented under new Unix Resource Limits section.
* New function: add-suffix.Kaz Kylheku2021-07-101-0/+1
| | | | | | | | | | | * stream.c, stream.h (add_suffix): New function. (stream_init): add-suffix intrinsic registered. * tests/018/path.tl: Tests. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* New functions: trim-short-suffix, trim-long-suffix.Kaz Kylheku2021-07-101-0/+2
| | | | | | | | | | | | | | | * lib.c, lib.h (chk_substrdup): New function. * stream.c, stream.h (trim_short_suffix, trim_long_suffix): New functions. (stream_init): trim-short-suffix and trim-long-suffix intrinsics registered. * tests/018/path.tl: New tests. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* lib: new function separate.Paul A. Patience2021-07-091-4/+5
| | | | | | | | | | | | * lib.c (separate): New function. * lib.h (separate): Declared. * eval.c (eval_init): Register separate intrinsic. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* defstruct: diagnose built-in type being redefined.Kaz Kylheku2021-07-091-0/+1
| | | | | | | | | | | | | | | | | | * eval.c (eval_init): Register built-in-type-p intrinsic. * lib.c (buitin_type_p): Rename to built_in_type_p since the word built-in is hyphenated. The function also tests whether the argument is a COBJ class. (cobj_class_exists): Function removed. * stdlib/doc-syms.tl: Updated. * stdlib/struct.tl (defstruct): Add built-in-type-p check. * struct.c (make_struct_type): Call only built_in_type_p; cobj_class_exists is gone. * txr.1: Document built-in-type-p.
* doc: cptr-put does not exist.Kaz Kylheku2021-07-021-1/+1
| | | | | | | | | | | * 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-011-1/+1
| | | | | | | * 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.
* doc: fix various issues in .coNP lines.Paul A. Patience2021-07-011-119/+118
| | | | | | | | | | | * 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.
* New function: find-true.Kaz Kylheku2021-06-291-2/+3
| | | | | | | | | | | | | | | 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-291-0/+1
| | | | | | | | | | | | * 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.
* regex: exposing optimization pass a regex-optimizeKaz Kylheku2021-06-271-0/+1
| | | | | | | | | | | | * regex.c (regex_optimize): New static function, capturing the three optimization passes. (regex_compile): Code moved into regex_optimize. (regex_init): Remove sys:reg-optimize function. Register regex-optimize. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* file layout: moving share/txr/stdlib to stdlib.Kaz Kylheku2021-06-241-0/+2084
This affects run-time also. Txr installations where the executable is not in directory ending in ${bindir} will look for stdlib rather than share/txr/stdlib, relative to the determined installation directory. * txr.c (sysroot_init): If we detect relative to the short name, or fall back on the program directory, use stdlib rather than share/txr/stdlib as the stdlib_path. * INSTALL: Update some installation notes not to refer to share/txr/stdlib but stdlib. * Makefile (STDLIB_SRCS): Refer to stdlib, not share/txr/stdlib. (clean): In unconfigured mode, remove the old share/txr/stdlib entirely. Remove .tlo files from stdlib. (install): Install lib materials from stdlib. * txr.1: Updated documentation under Deployment Directory Structure. * share/txr/stdlib/{asm,awk,build,cadr}.tl: Renamed to stdlib/{asm,awk,build,cadr}.tl. * share/txr/stdlib/{compiler,conv,copy-file,debugger}.tl: Renamed to stdlib/{compiler,conv,copy-file,debugger}.tl. * share/txr/stdlib/{defset,doc-lookup,doc-syms,doloop}.tl: Renamed to stdlib/{defset,doc-lookup,doc-syms,doloop}.tl. * share/txr/stdlib/{each-prod,error,except,ffi}.tl: Renamed to stdlib/{each-prod,error,except,ffi}.tl. * share/txr/stdlib/{getopts,getput,hash,ifa}.tl: Renamed to stdlib/{getopts,getput,hash,ifa}.tl. * share/txr/stdlib/{keyparams,match,op,optimize}.tl: Renamed to stdlib/{keyparams,match,op,optimize}.tl. * share/txr/stdlib/{package,param,path-test,pic}.tl: Renamed to stdlib/{package,param,path-test,pic}.tl. * share/txr/stdlib/{place,pmac,quips,save-exe}.tl: Renamed to stdlib/{place,pmac,quips,save-exe}.tl. * share/txr/stdlib/{socket,stream-wrap,struct,tagbody}.tl: Renamed to stdlib/{socket,stream-wrap,struct,tagbody}.tl. * share/txr/stdlib/{termios,trace,txr-case,type}.tl: Renamed to stdlib/{termios,trace,txr-case,type}.tl. * share/txr/stdlib/{ver,vm-param,with-resources,with-stream}.tl: Renamed to stdlib/{ver,vm-param,with-resources,with-stream}.tl. * share/txr/stdlib/yield.tl: Renamed to stdlib/yield.tl. * share/txr/stdlib/{txr-case,ver}.txr: Renamed to stdlib/{txr-case,ver}.txr. * gencadr.txr: Update to stdlib/place.tl. * genman.txr: Update to stdlib/cadr.tl.