summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* doc: formatting under Special Structure Functions.Kaz Kylheku2019-11-181-2/+2
| | | | | * txr.1: Use .mets instead of .meti on the syntax; this produces an indentation.
* New functions for buf <--> integer conversion.Kaz Kylheku2019-11-181-0/+107
| | | | | | | | | * buf.c (buf_int, buf_uint, int_buf, uint_buf): New static functions. (buf_init): buf-int, buf-uint, int-buf and uint-buf intrinsic functions registered. * txr.1: Documented.
* open-process: new variant, open-subprocess.Kaz Kylheku2019-11-071-0/+32
| | | | | | | | | | | | * stream.c (open_subprocess): new function, formed by adding fun argument to open_process. Since the program name can be nil now, in which case argv is not allocated, the code must be careful not to access argv if it is null. (open_process): Reduced to trivial wrapper around open_subprocess. (stream_init): open-subprocess intrinsic registered. * txr.1: Documented.
* open-process: I/O redirection feature.Kaz Kylheku2019-11-061-7/+112
| | | | | | | | | | | | | | | | | In the mode-string of open-process, I/O redirections can now be specified that are carried out in the child process. * stream.c (do_parse_mode): Parse the redirection syntax indicated by >, which has a short and long form. The redirections are entered into a small table in the mode structure. (open_process): In the child process, perform the redirection specified in the mode structure's redirection table. * stream.h (STDIO_MODE_NREDIRS): New preprprocessor symbol. (struct stdio_mode): New array member, redir. * txr.1: Documented.
* syntax: new .? operator for null-safe object access.Kaz Kylheku2019-11-051-7/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | * lib.c (obj_print_impl): Render the new syntactic conventions introduced in qref/uref back into the .? syntax. The printers for qref and uref are united into a single implementation to reduce code proliferation. * parser.l (grammar): Produce new tokens OREFDOT and UOREFDOT. * parser.y (OREFDOT, UREFDOT): New terminal symbols. (n_expr): Handle .? syntax via the new OREFDOT and UOREFDOT token via qref_helper and uoref_helper. Logic for the existing referencing dot is moved into the new qref_helper function. (n_dot_expr): Handle .? syntax via uoref_helper. (uoref_helper, qref_helper): New static functions. * share/txr/stdlib/struct.tl (qref): Handle the new case when the expression which gives the object is (t expr). Handle the new case when the first argument after the object has this form, and is followed by more arguments. Both these cases emit the right conditional code. (uref): Handle the leading .? syntax indicated by a leading t by generating a lambda which checks its argument for nil. Transformations to qref handle the other cases. * txr.1: Documentation updated in several places.
* hash: new hash-reset function.Kaz Kylheku2019-11-021-1/+22
| | | | | | | | | * hash.c (hash_reset): New function. (hash_init): hash-reset intrinsic registered. * hash.h (hash_reset): Declared. * txr.1: Documented.
* stat: support high resolution time stamps.Kaz Kylheku2019-10-291-2/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | * configure (have_sys_stat): New variable. Set to y when our test detects <sys/stat.h>. New test added for the presence of high resolution time stamps in struct stat. If we have these, we #define HAVE_STAT_NSEC 1 in config.h. * share/txr/stdlib/path-test.tl (path-newer): Compare nanosecond parts of the modification time if the seconds are equal, improving the resolution of the test. * sysif.c (atime_nsec_s, mtime_nsec_s, ctime_nsec_s): New symbol variables. (stat_to_struct): If nanosecond resolution is available, set the new nanosecond slots from the three tv_nsec fields in struct stat. Otherwise, set the new slots to zero. (sysif_init): Initialize the new symbol variables. Add the three new slots to the stat struct. * sysif.c (atime_nsec_s, mtime_nsec_s, ctime_nsec_s): Declared. * txr.1: Documented new atime-nsec, mtime-nsec and ctime-nsec slots of stat structure. Added note to path-newer mentioning high resolution support.
* naming: get the -func out, at least some of it.Kaz Kylheku2019-10-291-29/+29
| | | | | | | | | | | | | | | | | | | | The code base contains a lot of irksome _func which should be _fun, and also the public functions func-get-form and func-get-name are irksomely named. As a first step, we can fix parameters which carry this suffix. * glob.c (global_wrap): errfunc argument renamed to errfun. * glob.h (global_wrap): Likewise. * hash.h (hash_uni, hash_isec): join_func argument renamed to joinfun. * hash.h (hash_uni, hash_isec): Likewise. * txr.1: fixed gen-func typo. Arguments renamed in descriptions of hash-uni, hash-isec, iff, iffi, glob, and ftw.
* doc: bad expression under hash-list.Kaz Kylheku2019-10-281-1/+1
| | | | | | * txr.1: The example apply call wouldn't work as written because hash is looked up in the variable namespace. We must use DWIM brackets.
* New function: hash-invert.Kaz Kylheku2019-10-281-0/+95
| | | | | | | | | * hash.c (hash_invert): New function. (hash_init): hash-invert intrinsic registered. * hash.c (hash_invert): Declared. * txr.1: Documented.
* New function: identity*Kaz Kylheku2019-10-281-2/+9
| | | | | | | | | | | | | | | An version of identity with lax argument conventions. * eval.c (eval_init): Register identity* intrinsic. * lib.c (identity_star_f): New symbol variable. (identity_star): New function. (obj_init): gc-protect identity_star_f variable, and initialize it. * lib.h (identity_star_f): Declared. * txr.1: Documented.
* doc: bogus paragraph removed under vec-push.Kaz Kylheku2019-10-281-7/+0
| | | | | * txr.1: There is no relationship between vec-push and ref; nonsense paragraph removed.
* Version 227.txr-227Kaz Kylheku2019-10-261-3/+3
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise.
* Version 226.txr-226Kaz Kylheku2019-10-251-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.