summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
* New functions chmod-rec and chown-rec.Kaz Kylheku2020-01-311-0/+43
| | | | | | | | | | | * lisplib.c (copy_file_set_entries): Add chown-rec and chmod-rec to list of symbols that trigger auto-load of copy-file.tl. * share/txr/stdlib/copy-file.tl (chmod-rec, chown-rec): Neew functions. * txr.1: Documented.
* doc: missing catch** in heading.Kaz Kyheku2020-01-311-1/+1
| | | | | * txr.1: The catch section fails to mention the catch** operator in the section heading.
* doc: repeated "continues" under do directive.Kaz Kyheku2020-01-311-1/+1
| | | | * txr.1: fix repeated word.
* doc: defex does allow duplicate registration.Kaz Kyheku2020-01-311-13/+9
| | | | | | | | * txr.1: Fix wrong documentation about defex. It does allow registration of duplicate relationhips and updates that do not create cycles. Document a rule that is missing: that a subtype relationships can't be registered when the opposite relationship already exists.
* c_str: don't allow symbols.Kaz Kyheku2020-01-311-0/+10
| | | | | | | | | | | | | | | | | | | | | | | On 2009-10-02, prior to TXR 014, I made a change to the c_str function to allow symbolic arguments, so that c_str(sym) could be used in the code base instead of c_str(symbol_name(sym)). This was a bad idea, and is allowing numerous functions that operate on strings to accept symbols also. That behavior is not documented and not consistently supported. Ironically, I completely forgot about this and have been consistently using symbol_name(sym) anyway. Let us remove this. Compat support is required because this will break user code that accidentally depends on this undocumented behavior. * lib.c (c_str): If the object is type SYM, only return the symbol_name if compatibility with 231 or older is requested, otherwise fall through to the error case. * match.c (dump_var): Fix one case where a symbol is passed directly to put_string. This fails one of the test cases. More testing is required to see if any other such cases occur. * txr.1: New entry in the compatibility notes.
* open-files: add mode string argument.Kaz Kyheku2020-01-311-3/+14
| | | | | | | | | | | | The open-files and open-files* functions are missing a mode string argument, which makes it impossible to, say, open all of the files in "rb" mode on a platform where that matters. * stream.c (open_files, open_files_star): Take mode as a third optional parameter. If it is present, then pass it to open_file. * txr.1: Document mode string parameter for the two functions.
* doc: remove-path copy-paste error.Kaz Kyheku2020-01-301-1/+1
| | | | * txr.1: Under rename-path, remove-path is wrongly referenced.
* New: file copy, recursive copy, recursive delete.Kaz Kylheku2020-01-291-0/+307
| | | | | | | | | | | | | * lisplib.c (copy_file_instantiate, copy_file_set_entries): New static functions. (lisplib_init): Register auto-load of copy-file.tl via new functions. * share/txr/stdlib/copy-file.tl: New file. * txr.1: New section Unix Filesystem Complex Operations. Here copy-file, copy-files, copy-path-rec and remove-path-rec are documented.
* New retry and skip exceptions under restart hierarchy.Kaz Kyheku2020-01-301-1/+18
| | | | | | | * unwind.c (uw_late_init): Register retry and skip symbols as exception subtypes of restart. * txr.1: Document retry and skip restarts.
* New function: merge-delete-package.Kaz Kyheku2020-01-291-0/+23
| | | | | | | | | | | | | | | | | | | | | This is a useful function which supports the use of temporary packages over the scope of file compilation units. A file can be read under a temporary package which provides usefully customized symbol visibility consisting of an arrangement of symbols from various other packages. Then, in a single operation, thanks to this new function, that packag can be deleted and all of its local symbols (those having been newly interned over the course of the file) are transferred to some other, more permanent package. * eval.c (eval_init): merge-delete-package intrinsic registered. * lib.c (merge_delete_package): New function. * lib.h (merge_delete_package): Declared. * txr.1: Documented.
* ftw: throw exception on failure.Kaz Kyheku2020-01-281-10/+48
| | | | | | | | | | | | | | | | The ftw function just returns -1 if, for instance, given a bad path (nonexistent or no permissions). The documentation also has issues. * ftw.c (ftw_wrap): If the return value is -1, convert it to a file-error using errno_to_file_error and throw a diagnostic exception. This situation can, of course, arise if the callback function returns -1, in which case it should prepare a value in errno. * txr.1: Return value of callbackfn documented better. Documented exception throwing behavior, and failed termination if the callback returns -1.
* New function: rmdir.Kaz Kylheku2020-01-281-0/+20
| | | | | | | * sysif.c (rmdir_wrap): New static function. (sysif_init): rmdir intrinsic registered. * txr.1: Documented.
* New functions: chown, lchown.Kaz Kyheku2020-01-281-0/+77
| | | | | | | | | | * configure: New configure test for chown, fchown and lchown. * sysif.c (get_fd): Define for HAVE_CHOWN also. (do_chown, chown_wrap, lchown_wrap): New functions. (sysif_init): chown and lchown intrinsics registered. * txr.1: Documented.
* ensure-dir: return nil when exists.Kaz Kylheku2020-01-271-5/+10
| | | | | | | * sysif.c (mkdir_nothrow_exists): Return nil in the existence case, when the object is a directory or a symlink to one. * txr.1: Updated.
* ensure-dir: fail if exists and not dir.Kaz Kylheku2020-01-251-1/+4
| | | | | | | | | | | | | * sysif.c (do_stat, do_lstat): Functions relocated before mkdir_nothrow_exists. (mkdir_nothrow_exists): In the EEXIST case, call stat on the object. If it's not a directory or a symlink to a directory, then do not suppress the error; propagate it to the caller, where it will become an exception. * txr.1: Specify the behavior of ensure-dir more precisely: that it only supresses the existence error for directories and directory symlinks.
* New function: mkfifo.Kaz Kylheku2020-01-231-0/+27
| | | | | | | * configure: detect mkfifo. (sysif_init): Register mkfifo intrinsic. * txr.1: Documented.
* New functions utimes, lutimes.Kaz Kylheku2020-01-211-0/+105
| | | | | | | | | | | | | * configure: Detect various functions for setting file timestamps. * sysif.c (get_fd): Define this function for use by utimes also. (timens, do_utimes): New static functions. (wrap_utimes, wrap_lutimes): New static functions. (sysif_init): Register utimes and lutimes intrinsics. * txr.1: Documented.
* New function: coded-length.Kaz Kylheku2020-01-181-0/+18
| | | | | | | | * eval.c (eval_init): Register coded-length intrinsic. * lib.c (coded_length): New function. * lib.h (coded_length): Declared.
* fstat: take fd argument.Kaz Kyheku2020-01-151-3/+7
| | | | | | | * sysif.c (get_fd): Make available under HAVE_SYS_STAT. (fstat): Allow fd or stream argument using get_fd. * txr.1: Documented.
* with-resources: support multiple cleanup forms.Kaz Kyheku2020-01-151-10/+31
| | | | | | | | * share/txr/stdlib/with-resources.tl (with-resources): Rearrange tree-case cases to recognize a sequence of cleanup forms and insert into the output accordingly. * txr.1: Documented.
* chmod: work on streams and descriptors using fchmod.Kaz Kyheku2020-01-151-4/+25
| | | | | | | | | * configure: extend chmod detection to cover fchmod. * sysif.c (get_fd): New static functions. (chmod_wrap): Include fchmod wrapping for integer or stream argument. (sysif_init): Register fchmod intrinsic.
* Version 231.txr-231Kaz Kylheku2020-01-121-3/+3
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Copyright year bump 2020.Kaz Kylheku2019-12-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * LICENSE, LICENSE-CYG, METALICENSE, Makefile, alloca.h, args.c, args.h, arith.c, arith.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, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c, lib.h, linenoise/linenoise.c, linenoise/linenoise.h, lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h, parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c, regex.h, share/txr/stdlib/asm.tl, share/txr/stdlib/awk.tl, share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl, share/txr/stdlib/compiler.tl, share/txr/stdlib/conv.tl, share/txr/stdlib/debugger.tl, share/txr/stdlib/defset.tl, share/txr/stdlib/doloop.tl, share/txr/stdlib/error.tl, share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl, share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl, share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl, share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl, share/txr/stdlib/package.tl, share/txr/stdlib/param.tl, share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl, share/txr/stdlib/pmac.tl, share/txr/stdlib/save-exe.tl, share/txr/stdlib/socket.tl, share/txr/stdlib/stream-wrap.tl, share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl, share/txr/stdlib/termios.tl, share/txr/stdlib/trace.tl, share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl, share/txr/stdlib/vm-param.tl, share/txr/stdlib/with-resources.tl, share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl, signal.c, signal.h, socket.c, socket.h, stream.c, stream.h, struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h, syslog.c, syslog.h, termios.c, termios.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: Extended copyright notices to 2020.
* doc: usage note for compile-update-file.Kaz Kylheku2019-12-231-0/+16
| | | | | | * txr.1: Document how compile-update-file can be used together with load to ensure that the compiled version of a file is loaded without unnecessary recompiling.
* doc: redocument keyword argument description.Kaz Kylheku2019-12-231-15/+29
| | | | | | * txr.1: Under :key parameter macro, rewriting the description of what keyword arguments are. This was prompted by the strange wording "Arguments to keyword appear ...".
* doc: spurious blank line under build macro.Kaz Kylheku2019-12-231-1/+0
| | | | * txr.1: Remove spurious blank line.
* New function: compile-update-file.Kaz Kylheku2019-12-221-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | The new function only compiles a file if the output file doesn't exist or is out of date. In addition, both compile-file now deletes the output file if compilation fails, and has a documented return value. * lisplib.c (compiler_set_entries): Add autoload entry fro compile-update-file. (open-compile-streams): Accepts a third argument: a function to test the input stream against the output path. The output file is opened, and the streams are returned, only if that test function returns true. Also, a third element is returned: the output path. This lets the caller to know what to delete, if the output file must be deleted. (compile-file-conditionally): New internal function, formed from compile-file. Takes an extra argument, the test function to pass to open-compile-streams. Compilation is skipped if open-compile-streams returns nil. Internals reshuffled a bit. If compilation doesn't set the success flag, then the with-resources logic now removes the output file in addition to closing the output stream. Prior to setting the success flag, we flush the output stream. * txr.1: Documented new function, all return values, and deletion of output file on unsuccessful compilation.
* Version 230.txr-230Kaz Kylheku2019-12-201-3/+3
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise.
* Version 229.txr-229Kaz Kylheku2019-12-141-2/+2
| | | | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated. * protsym.c: Likewise.
* ffi: new type zcharKaz Kylheku2019-12-141-20/+85
| | | | | | | | | | | | | | | | | | | The zchar type, when used as an array element, specifies an optionally null-terminated or padded field, which is subject to UTF-8 conversion. * ffi.c (zchar_s): New symbol variable. (enum char_conv): New member, conv_zchar. (ffi_zchar_array_get): New static function. (ffi_array_in, ffi_array_get_common): Handle conv_zchar via ffi_zchar_array_get. (ffi_array_put): Handle conv_char together with conv_zchar. (ffi_type_compile): Handle zchar array element type, mapping to conv_zchar. (ffi_init_types): Register zhar type. (ffi_init): Initialize zchar_s symbol variable. * txr.1: Documented.
* doc: doubled word in compat note.Kaz Kylheku2019-12-131-1/+1
| | | | | * txr.1: fix "invoked invoked" in compatibility note for compat value 151.
* doc: make-buf: document default value.Kaz Kylheku2019-12-131-2/+5
| | | | | * txr.1: documnt that the default value of the optional alloc-size parameter is taken from the len parameter.
* multiple-inheritance: super-method loose ends.Kaz Kylheku2019-12-131-11/+16
| | | | | | | | | | | | | | | | | * struct.c (do_super): New function. Now the common implementation for call_super_method, call_super_fun and super_method. (call_super_method, call_super_fun): Reduced to small wrappers around do_super. (super_method): Drill into the object to geet the struct_type handle, and then use do_super to get the method. * tests/012/oop-mi.tl: New tests for call-super-fun and call-super-method. * tests/012/oop-mi.expected: Updated. * txr.1: Updated.
* OOP: implementing multiple inheritance.Kaz Kylheku2019-12-111-17/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Multiple inheritance is too useful to ignore any longer. * lib.c (subtypep): Perform subtypep calculation between two struct types via the new struct_subtype_p function. It's too complicated now to do with ad hoc code outside of struct.c. * share/txr/stdlib/struct.tl (defstruct): This macro now needs to deal with the super argument being possibly a list of base types instead of a single one. * strut.c (struct struct_type): Member super and super_handle are removed. New member nsupers, supers, and sus. (struct_init): The super function re-registered; it has an optional argument. (call_stinitfun_chain): The compat code here must now access the supertype differently. We don't bother dealing with multiple inheritance in the compat case; programs requesting compatibility with TXR 151 shoudn't be trying to use multiple inheritance. (get_struct_handles, count_super_stslots, get_super_slots, find_super_for_slot): New static functions, to off-load some new complexity from make_struct_type. (make_struct_type): Handle the increased complexity due to multiple inheritance. (super): Takes an additional argument now, to request which supertype to retrieve. Defaults to zero: the first one. (struct_type_destroy): Free the sus array. (struct_type_mark): Mark the supers slot. (call_initfun_chain): Call init functions of all bases, in right-to-left order. (call_postinitfun_chain): Likewise for postinit functions. (call_super_method, call_super_fun, super_method): Use the first base as the supertype. This requirement feels bad; it needs to be revisited. (do_struct_subtype_p): New static function. (struct_subtype_p): New function. (ancestor_with_static_slot): New static function. (method_name): Revised for multiple inheritance; now relies on ancestor_with_static_slot to find the original ancestor that has brought in a method, so we can use that type in the method name. * struct.h (super): Declaration updated. (struct_subtype_p): Declared. * tests/012/oop-mi.expected: New file. * tests/012/oop-mi.tl: New test cases. * txr.1: Revised in order to document multiple inheritance.
* doc: clarify inheritance of static slot value.Kaz Kylheku2019-12-091-0/+31
| | | | | | | | | * txr.1: In relation of the previous bugfix, a certain situation is worth clarifying. A static slot does not inherit the value of a grandparent type's static slot of the same name, if the supertype has specified that slot as an instance slot. Inheritance of the static slot value is from the direct supertype only.
* New function: path-dir-empty.Kaz Kylheku2019-12-091-0/+28
| | | | | | | | | | * lisplib.c (path_test_set_entries): Autoload entry for path-dir-empty. * share/txr/stdlib/path-test.tl (path-dir-empty): New function. * txr.1: Documented.
* Add hyperbolic functions: sinh, cosh, and others.Kaz Kylheku2019-12-071-0/+22
| | | | | | | | | | | | | | | | | | | | * arith.c (sinh_s, cosh_s, tanh_s, asinh_s, acosh_s, atanh_s): New symbol variables. (sinh, cosh, tanh, asinh, acosh, atanh): New static functions. (sineh, cosih, tangh, asineh, acosih, atangh): New functions. (arith_init): Register sinh, cosh, tanh, asinh, acosh and atanh intrinsic functions, and initialize the new symbol variables. * configure: Detect availability of hyperbolic functions in math library and defne HAVE_HYPERBOLICS as 1 in config.h accordingly. * lib.h (sineh, cosih, tangh, asineh, acosih, atangh): Declared. * txr.1: Documented new hyperbolic functions and their method counterparts that a numeric struct can implement.
* ffi: allow init-forms for slots.Kaz Kylheku2019-12-061-2/+40
| | | | | | | | | | | | | | | * ffi.c (ffi_memb_compile): Don't complain about three-argument slot specifiers, only about longer ones. (ffi_struct_init): New static function. (ffi_type_compile): Deal with third element in the slot syntax. If there are any non-nil initializing expressions, then we when we call make_struct_type, we specify an initfun, which will plant the values into the slots, using logic similar to that of the initfun generated defstruct, except that the init-forms are reduced to values up-front. * txr.1: Specify optional init-form for slots in FFI struct syntax.
* getopts: new define-option-struct macro.Kaz Kylheku2019-11-291-1/+135
| | | | | | | | | | | | This provides more streamlined option processing. * lisplib.c (getopts_set_entries): Add auto-load entry for define-option-struct. * share/txr/stdlib/getopts.tl (define-option-struct): New macro. * txr.1: Documented.
* doc: getopt: long and short options appear in index.Kaz Kylheku2019-11-291-0/+17
| | | | | | | | * txr.1: Document that in the parsed opts object returned by getopts, an option which has two names (long and short form) is indexed under both names if it has occurred in the command line, regardless of whether it has occurred under the short or long name.
* doc: ffi-make-callback doesn't exist.Kaz Kylheku2019-11-251-1/+1
| | | | | * txr.1: Under deffi-cb, correcting a reference to nonexistent ff-make-callback to ffi-make-closure.
* New function: buf-list.Kaz Kylheku2019-11-201-0/+20
| | | | | | | | | * buf.c (buf_list): New function. (buf_init): buf-list intrinsic registered. * buf.h (buf_list): Declared. * txr.1: Documented.
* doc: macro-time update.Kaz Kylheku2019-11-191-23/+74
| | | | | | | * txr.1: Update outdated documentation. macro-date is not required any more in the indicated situations. But it can still be required sometimes, and has some interesting uses. More detail added.
* Version 228.txr-228Kaz Kylheku2019-11-181-2/+2
| | | | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated. * protsym.c: Likewise.
* ffi: rename functions in the carray-num group.Kaz Kylheku2019-11-181-14/+30
| | | | | | | | | | | | | | * ffi.c (carray_unum, carray_num, unum_carray, num_carray): Functions renamed to carray_uint, carray_int, uint_carray, int_carray. (ffi_init): Functions registered under new names: carray-uint, carray-int, uint-carray, int-carray. Compat values of 227 or less provide the old old names. * ffi.h (carray_unum, carray_num, unum_carray, num_carray): Declarations renamed. * txr.1: Updated to new names; compat note added.
* doc: wrong word under stream sockets.Kaz Kylheku2019-11-181-1/+1
| | | | | * txr.1: The word "times" appeared in place of "types". Reported by vapnik spaknik.
* doc: inaccurate apf/ipf description.Kaz Kylheku2019-11-181-6/+13
| | | | | | | * txr.1: User vapnik spaknik pointed out the poor documentation for apf, which stated that it takes one argument which is a list, when in fact it more generally takes and works with apply-like arguments.
* doc: various copy and paste mistakes.Kaz Kylheku2019-11-181-4/+4
| | | | | | * txr.1: Fix copy and paste errors affecting flo-zero, struct sockaddr-in6, sockaddr-unix and sock-bind. Reported by user vapnik spaknik.
* doc: incorrect partition* example.Kaz Kylheku2019-11-181-1/+1
| | | | | * txr.1: Fix incorrect return value. Reported by user vapnik spaknik.
* doc: wrong argument reference under regsub.Kaz Kylheku2019-11-181-3/+3
| | | | | | * txr.1: Fix wording that refers to first argument as the second argument. It is the second form element, of course, but the first argument. Reported by user vapnik spaknik.