summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
* New: CRC-32 functions.Kaz Kylheku2019-06-241-0/+43
| | | | | | | | | | | | * Makefile (OBJS): Add chksums/crc32.o. * chksum.c (crc32_stream, crc32): New functions. (chksum_init): Register crc32-stream and crc32 intrinsic functions. * chksums/crc32.c, chksums/crc32.h: New files. * txr.1: Documented.
* * Makefile (OBJS): New objects chksum.o and chksums/sha256.o.Kaz Kylheku2019-06-231-0/+45
| | | | | | | | | | * chksum.c, chksum.h, chksums/sha256.c, chksums/sha256.h: New files. * lib.c (init): Call chksum_init. * txr.1: Documented. * LICENSE: Add SHA-256 copyright notice.
* doc: move buffers out of dynamic lib section.Kaz Kylheku2019-06-231-1341/+1343
| | | | | | | | * txr.1: Buffers are now documented after strings and vectors. Buffer streams are in the I/O section. Note: the diff between this and the previous commit needs to be generated with git diff --minimal. Otherwise it looks like over 30,000 lines of changes.
* base64: integrate with buffers.Kaz Kylheku2019-06-211-7/+22
| | | | | | | | | | | | | | | * filter.c (base64_encode): Handle an object of either string or buffer type by using make_byte_input_stream. (base64_decode_buf): New function. (filter_init): Register base64-decode-buf intrinsic. * filter.h (base64_decode_buf): Declared. * stream.c (make_byte_input_stream): New function. * stream.h (make_byte_input_stream): Declared. * txr.1: Updated.
* doc: minor grammar problems in Lisp CompilationKaz Kylheku2019-06-211-2/+2
| | | | | * txr.1: Two issues fixed while proof-reading: missing "a" article and a missing plural.
* doc: cure that-is-itis.Kaz Kylheku2019-06-211-3/+3
| | | | | * txr.1: In two places, fix an awkward "; that is, has ..." and "; that is, is ..." grammatical curiosity.
* doc: dump-compiled-objects: wrong number.Kaz Kylheku2019-06-201-1/+1
| | | | * txr.1: "following three expressions" should be "two".
* Version 218.txr-218Kaz Kylheku2019-06-191-3/+3
| | | | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated. * protsym.c: Likewise.
* New function: bitset.Kaz Kylheku2019-06-181-0/+58
| | | | | | | | | | | * arith.c (bitset_s): New symbol variable. (bitset): New function. (arith_init): bitset_s initialized, bitset intrinsic registered. * lib.h (bitset): Declared. * txr.1: Documented bitset function and method.
* sub-list, sub-vec, sub-str: becoming accessors.Kaz Kylheku2019-06-171-4/+91
| | | | | | | | | | | * lisplib.c (defset_instantiate): Add sub-list, sub-vec and sub-str symbols as autoload triggers for defset.tl. * share/txr/stdlib/defset.tl (sub-list, sub-vec, sub-str): New syntactic places defined with defset. * txr.1: sub-list, sub-vec and sub-str documented as accessors.
* buffers: sub-buf becomes accessor.Kaz Kylheku2019-06-171-1/+17
| | | | | | | | | | * lisplib.c (ffi_set_entries): Register autoload for sub-buf symbol. * share/txr/stdlib/ffi.tl (sub-buf): Syntactic place defined via defset. * txr.1: Updated sub-buf documentation.
* doc: sub place semantics described wrongly.Kaz Kylheku2019-06-171-4/+36
| | | | | | * txr.1: Documentatation for sub accessor fails to specify that the seq variable is updated with the value returned by replace.
* carray-sub: improved accessor.Kaz Kylheku2019-06-171-3/+12
| | | | | | | | | | | | | * share/txr/stdlib/ffi.tl (carray-sub): We use defset to define a carray-sub place that updates via carray-replace, rather than using a place macro to defer to the generic sub accessor. This results in a more efficient implementation. This new accessor doesn't require the carray argument to be a place; unlike sub, it doesn't have to capture the return value of carray-replace and store it back into the carray variable. * txr.1: Updated doc.
* doc: defset short form is like define-accessorKaz Kylheku2019-06-161-3/+17
| | | | | | * txr.1: Add mentions of the forgotten define-accessor macro in text that lists ways of defiing places. Cross-reference short form of defset and define-accessor.
* doc: nftw typo.Kaz Kylheku2019-06-161-1/+1
| | | | * txr.1: Fix ftw function being mistakenly called nftw.
* doc: reduce amount of "This function" wording.Kaz Kylheku2019-06-161-26/+76
| | | | | | * txr.1: Numerous library functions whose Description paragraph begins with "This function" are now introduced by their name.
* doc: listp and proper-list-p are list only.Kaz Kylheku2019-06-161-0/+6
| | | | * txr.1: Clarify that list-like sequences are not lists.
* doc: improvements in sub + replace variants.Kaz Kylheku2019-06-161-43/+34
| | | | | | | | | | | | * txr.1: The wording is improved in the description of sub-list, replace-list and all the other type specific specializations of sub and replace. We avoid starting the descriptions with "This function", and vague wording such as "is like the sub function". Superfluous, obvious text like "for a description of the semantics, see the sub function" is removed. Also we avoid saying that the sub-list and replace-list functions operate strictly on lists, since they in fact operate on anything that supports list operations.
* doc: carray-pun copy-paste issue.Kaz Kylheku2019-06-151-1/+1
| | | | | * txr.1: Fix syntax section for carray-pun wrongly showing carray-sub function name.
* buffers: expose sub-buf and replace-buf.Kaz Kylheku2019-06-151-0/+59
| | | | | | | * buf.c (buf_init): Intrinsics sub-buf and replace-buf registered. * txr.1: Documented.
* compile-file: translate --lisp option in hash bang.Kaz Kylheku2019-06-141-1/+5
| | | | | | | | * share/txr/stdlib/compiler.tl (usr:compile-file): Edit the hash-bang line to replace the --lisp option with --compiled. This supports the situation when a TXR Lisp hash bang script that is unsuffixed is compiled to an unsuffixed compiled script.
* cat-str, split-str: sep can be character.Kaz Kylheku2019-06-141-5/+7
| | | | | | | * lib.c (cat_str, split_str_keep): Support single character separator. * txr.1: Documented.
* select: maintenance.Kaz Kylheku2019-06-141-8/+17
| | | | | | | | | * lib.c (sel): Function converted to seq_info and iterators. Negative indices handled in list case. Self-name corrected to select; the C function is called sel just to avoid clashing with POSIX select. * txr.1: Documentation updated.
* replace-list: negatives in index-list follow convention.Kaz Kylheku2019-06-141-5/+13
| | | | | | | | | | The index-list replacement isn't following the convention that negative index values reference from the end of the target sequence. Let's fix that. * lib.c (replace_list): Likewise. * txr.1: Documentation updated.
* sub-vec: optimize no-op case.Kaz Kylheku2019-06-121-2/+1
| | | | | | | | | | * lib.c (sub_vec): If range covers entire vector, just return it. * txr.1: Clarify that the output of sub may share structure with the input regardless of type, not only when the input is a list. This should have been updated when the optimizatin was done in sub-str.
* doc: no such thing as varray.Kaz Kylheku2019-06-121-6/+6
| | | | | | * txr.1: carray is contrasted with the FFI type varray; but there is no such type. varray is a name used internally in the implementation; it means "variable-length zarray".
* doc: clarifications under zarrayKaz Kylheku2019-06-121-6/+17
| | | | | * txr.1: Clarify how the null element in the C array is generated for the dimensioned and undimensioned zarray.
* ffi: adjust in semantics of variable zarray.Kaz Kylheku2019-06-121-6/+2
| | | | | | | | | | | | | | | | | The replace function now returns a list if a nil object's is replaced with a range, rather than just returning the original item sequence. This breaks the variable array in operation, causing it to produce a list. We fix this sproblem, and also the nonsense semantics of the operation also; the operation should replace the original sequence, with the array, similarly to how null terminated strings work. * ffi.c (ffi_varray_null_term_in): If the original Lisp object isn't nil, then assume it's a sequence and replace it with the items gathered in the vector. Otherwise, replace it with the vector. * txr.1: Adjust documentation.
* New function: hash-peek.Kaz Kylheku2019-06-111-8/+25
| | | | | | | | | * hash.c (hash_peek): New function. (hash_init): hash-peek intrinsic registered. * hash.h (hash_peek): Declared. * txr.1: Documented.
* Version 217.txr-217Kaz Kylheku2019-06-101-3/+3
| | | | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated. * protsym.c: Likewise.
* Adding errno constants.Kaz Kylheku2019-06-091-0/+19
| | | | | | | | | | | | | | | | | | | | * sysif.c (sysif_init): registering variables e2big, eacces, eaddrinuse, eaddrnotavail, eafnosupport, eagain, ealready, ebadf, ebadmsg, ebusy, ecanceled, echild, econnaborted, econnrefused, econnreset, edeadlk, edestaddrreq, edom, edquot, eexist, efault, efbig, ehostunreach, eidrm, eilseq, einprogress, eintr, einval, eio, eisconn, eisdir, eloop, emfile, emlink, emsgsize, emultihop, enametoolong, enetdown, enetreset, enetunreach, enfile, enobufs, enodata, enodev, enoent, enoexec, enolck, enolink, enomem, enomsg, enoprotoopt, enospc, enosr, enostr, enosys, enotconn, enotdir, enotempty, enotrecoverable, enotsock, enotsup, enotty, enxio, eopnotsupp, eoverflow, eownerdead, eperm, epipe, eproto, eprotonosupport, eprototype, erange, erofs, espipe, esrch, estale, etime, etimedout, etxtbsy ewouldblock and exdev. * txr.1: Documented.
* Adding fcntl interface.Kaz Kylheku2019-06-091-0/+168
| | | | | | | | | | | | | | | | | | | * configure: changing HAVE_FCNTL_H to HAVE_FCNTL. * sysif.c (flock_s, type_s, whence_s, start_s, len_s, pid_s): New symbol variables. (flock_pack, flock_unpack, fcntl_wrap): New static functions. (sysif_init): Initialize new symbol variables. Create flock struct type. Register new intrinsic variables: o-accmode, o-rdonly, o-wronly, o-rdwr, o-creat, o-noctty, o-trunc, o-append, o-nonblock, o-sync, o-async, o-directory, o-nofollow, o-cloexec, o-direct, o-noatime, o-path, f-dupfd, f-dupfd-cloexec, f-getfd, f-setfd, fd-cloexec, f-getfl, f-setfl, f-getlk, f-setlk, f-setlkw, f-rdlck, f-wrlck, f-unlck, seek-set, seek-cur and seek-end. Register fcntl intrinsic function. * txr.1: Documented.
* place macros: adjustment to expansion strategy.Kaz Kylheku2019-06-051-17/+29
| | | | | | | | | | * share/txr/stdlib/place.tl (sys:pl-expand): At each expansion round, repeatedly expand the form as a place macro until that can no longer be done and only then try macroexpand-1, instead of just trying one place macro expansion. * txr.1: Updated and revised description of expansion under define-place-macro.
* posix: add close function.Kaz Kylheku2019-05-301-0/+22
| | | | | | | * sysif.c (close_wrap): New static function. (sysif_init): close intrinsic registered. * txr.1: Documented.
* doc: missing word under mask.Kaz Kylheku2019-05-291-1/+1
| | | | * txr.1: add missing "or" to make "bitwise or".
* doc: typo under ldiff.Kaz Kylheku2019-05-291-1/+1
| | | | * txr.1: Misplaced comma nudged left.
* doc: formatting of sident charsKaz Kylheku2019-05-291-3/+3
| | | | * txr: use .verb block instead of .mono block.
* path-private-to-me-p: bugfix: not including superuser.Kaz Kylheku2019-05-291-14/+22
| | | | | | | | | | | | * share/txr/stdlib/path-test.tl (path-private-to-me, path-strictly-private-to-me): These functions were neglecting to trust the root user, as documented. If the file is owned by root, we treat it as if it were owned by the caller. Furthermore, if we have to process the group membership, we allow the group to contain the superuser's name. * txr.1: Documentation improved, and the treatment of groups documented.
* Version 216.txr-216Kaz Kylheku2019-05-201-3/+3
| | | | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated. * protsym.c: Likewise.
* doc: missing deindent under Function FiltersKaz Kylheku2019-05-201-1/+1
| | | | * txr.1: .PP added.
* compile-file: input path harmonized with load.Kaz Kylheku2019-05-201-15/+81
| | | | | | | | | | | | | | * share/txr/stdlib/compiler.tl (open-compile-streams): The input file is now determined in a manner similar to the load function. If the path is relative and there is a *load-path* binding, then it is now considered relative to *load-path*. It is considered suffixed only if ending in .tl or .txr. If unsuffixed, then it is first tried with the .tl suffix. (usr:compile-file): Bind *load-path* to the actual path used for loading the file, rather than the input path. * txr.1: Documented.
* load: always bind *load-path* to actual path.Kaz Kylheku2019-05-201-14/+25
| | | | | | | | | | | * eval.c (load): Bind *load-path* to the real path that was used to open the file, not to the tentative path to which the .tl suffix was added, subject to compatibility option. * txr.1: Documentation for load revised for better wording and to document the above change. Fixed *load-path* being wrongly called a macro, and also load being called a macro. Compat note added.
* oop: derived hook.Kaz Kylheku2019-05-151-11/+67
| | | | | | | | | | | * struct.c (derived_s): New symbol variable. (struct_init): Initialize derived_s symbol. (make_struct_type): Check for derived method in parent, and invoke. * struct.h (derived_s): Declared. * txr.1: Documented.
* oop: new new* and lnew* macros.Kaz Kylheku2019-05-151-0/+27
| | | | | | | | | | | | * lisplib.c (struct_set_entries): Add autoload entries for new* and lnew* symbols. * share/txr/stdlib/struct.tl (sys:new-type, sys:new-expander): New functions. (new, lnew): Macros now implemented using sys:new-expander. (new*, lnew*): New macros. * txr.1: Documented.
* oop: new function: struct-type-name.Kaz Kylheku2019-05-151-0/+14
| | | | | | | | | * struct.c (struct_init): Register struct-type-name intrinsic. (struct_type_name): New function. * struct.h (struct_type_name): Declared. * txr.1: Documented.
* loading: try unsuffixed files directly last.Kaz Kylheku2019-05-011-62/+104
| | | | | | | | | | | | | | | | | | | | | | | | | In this patch we change the strategy for resolving unsuffixed paths in load and @(load). In load, an unsuffixed name is tried with a .tlo suffix, then .tl and only if those don't resolve to a file it is tried as-is. The previous order is as-is, .tlo, .tl. Similarly in @(load), but unsuffixed paths are tried as .txr, then .tlo, then .tl. The motivation for this is to avoid probing the filesystem multiple times the optimized case that we care about: loading .tlo files from Lisp. * parser.c (open_txr_file): Rearrange the probing strategy. Also recognize .txr_profile as a suffix, treating it like .tl. This is so that we don't probe for .txr_profile.tlo and .txr_profile.tl before finding the profile. (load_rcfile): Take advantage of the new path-not-found exception. We avoid wastefully checking with path-exists-p to avoid calling open_txr_file. We just let open_txr_file throw an exception if the file doesn't exist, and then distinguish the non-existence case in the handler. * txr.1: Updated @(load) and load documentation.
* lib: more nuanced file access errors.Kaz Kylheku2019-05-011-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several new more specific exception types are derived from file-error and used. Error handlers can distinguish unexpected non-existence, unexpected existence and permission errors from each other and other errors. * lib.c (path_not_found_s, path_exists_s, path_permission_s): New symbol variables. (obj_init): New variables initialized. * lib.h (path_not_found_s, path_exists_s, path_permission_s): Declared. * parser.c (open_txr_file): Use new errno_to_file_error function to convert errno to exception symbol. * socket.c (open_sockfd): Likewise. * stream.c (open_directory, open_file, open_fileno, open_command, open_process, run, remove_path, rename_path): Likewise, and process-error is used in open_process and run instead of file-error for problems related to creating the process. * sysif.c (errno_to_file_error): New function. (mkdir_wrap, ensure_dir, chdir_wrap, getcwd_wrap, mknod_wrap, chmod_wrap, symlink_wrap, link_wrap, readlink_wrap, stat_impl, umask_wrap, ): Use errno_to_file_error to convert errno to exception symbol. (exec_wrap): Use process-error instead of file-error. * sysif.c (errno_to_file_error): Declared. * unwind.c (uw_init): Register path-not-found, path-exists and path-permission as subtypes of file-error. * txr.1: Documented.
* New function: window-mapdo.Kaz Kylheku2019-04-211-1/+9
| | | | | | | | | | | | | | | | * lib.c (enum wmap_op): New enum type. (window_map_list): Use enum wmap_op for last argument instead of Boolean flag. If the argument is WMAP_MAPDO, do not accumulate. (window_map_vec, window_map, window_mapped): Adjust to new enum argument. (window_mapdo): New function. * lib.h (window_mapdo): Declared. * eval.c (eval_init): window-mapdo intrinsic registered. * txr.1: Documented.
* doc: document --backtraceKaz Kylheku2019-04-201-0/+12
| | | | | * txr.1: Document --backtrace and also that it is implied by --debug.
* New function: allocate-struct.Kaz Kylheku2019-04-191-0/+24
| | | | | | | | * struct.c (struct_init): allocate-struct intrinsic registered. (allocate_struct): New static function. * txr.1: Documented.