summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
* Functions for address prefixes to slash notation.Kaz Kylheku2016-02-291-0/+48
| | | | | | | | | | | * lisplib.c (sock_set_entries): Autload entries for str-inaddr-net and str-in6addr-net. * share/txr/stdlib/socket.tl (str-inaddr-net, str-in6addr-net): New functions. * txr.1: Documented str-inaddr, str-in6-addr, str-inaddr-net and str-in6addr-net.
* expand-left and nexpand-left functions.Kaz Kylheku2016-02-291-1/+73
| | | | | | | | * eval.c (expand_left, nexpand_left): New static functions. (eval_init): Registered expand-left and nexpand-left intrinsics. * txr.1: Documented.
* Implement @(next nil).Kaz Kylheku2016-02-291-0/+12
| | | | | | | | * match.c (v_next): If argument to @(next) is nil, then evaluate remaining query in context with no list of files, and no data. * txr.1: Documented @(next nil).
* Doc: syslog-related fixes.Kaz Kylheku2016-02-281-4/+5
| | | | | | * txr.1: Refer to parameter as options, not option, and use .meta consistently. Don't refer to Syslog section in all caps.
* Doc: elsif doesn't exist.Kaz Kylheku2016-02-281-1/+1
| | | | * txr.1: replace nonexistent @(elsif) in example with @(elif).
* Documenting sockets.Kaz Kylheku2016-02-281-0/+572
| | | | * txr.1: Documented.
* Adding --eargs mechanism.Kaz Kylheku2016-02-021-1/+81
| | | | | | * txr.c (txr_main): Implement --eargs. * txr.1: Documented.
* Support setuid operation.Kaz Kylheku2016-01-231-0/+46
| | | | | | | | | | | | | | | | | | | | | * sysif.c (orig_euid, real_uid, repress_called, is_setuid): New static variables. (repress_privilege, drop_privilage, simulate_setuid): New functions. (RC_MAGIC): New preprocessor symbol. * sysif.c (repress_privilege, drop_privilage, simulate_setuid): Declared. * txr.c (txr_main): Call repress_privilege to check and remember whether we are in setuid mode, and temporarily drop the effective uid to the real one. (txr_main): Permanently drop privileges in all cases except script execution. In script execution cases, go through simulate_setuid to either set or preserve the effective user ID, or else drop privs. * txr.1: Documented setuid operation in new section.
* Semantics fix: unhandled exceptions must still unwind.Kaz Kylheku2016-01-221-13/+16
| | | | | | | | | | | | | | | | | * unwind.c (unhandled_ex): New static structure. (unwind_to_exit_point): The code to print the unhandled exception info and bail the process is moved here out of uw_throw. We do this in the situation when we have an unhandled exception, which is represented by the fact that the exception pointer points to the unhandled_ex structure. (uw_throw): If unhandled hook isn't a function, we don't abort; we go through the unwinding and unhandled processing. Also, ditto if the unhandled function returns, ditto. Unhandled processing is entered by substituting unhandled_ex for the not-found exception, and allowing unwind_to_exit point to be called. * txr.1: Document new behavior for unhandled exceptions and *unhandled-hook*.
* Version 133.txr-133Kaz Kylheku2016-01-211-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Support for Base 64 encoding.Kaz Kylheku2016-01-211-0/+63
| | | | | | | | | | | | | * filter.c (tobase64_k, frombase64_k): New keyword symbol variables. (col_check, get_base64_char, b64_code): New static functions. (base64_decode, base64_encode): New functions. (filter_init): Initialize new keyword symbol variables, and register base64-encode and base64-decode intrinsic functions. * filter.h (base64_encode, base64_decode): Declared. * txr.1: Documented base64-encode, base64-decode, as well as :tobase64 and :frombase64.
* Grammar fix under string quasiliterals.Kaz Kylheku2016-01-191-1/+1
| | | | * txr.1: "variables substitutions".
* Grammar fix under cadr function.Kaz Kylheku2016-01-191-1/+1
| | | | * txr.1: "They encodes" fixed.
* New random-state-get-vec function.Kaz Kylheku2016-01-181-3/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | * arith.c (UINT_PTR_MAX_MP): New static variable. (biggnum_from_uintptr): New function. (in_uint_ptr_range): New static function. (c_uint_ptr_num): New function. (arith_init): Initialize UINT_PTR_MAX_MP. * arith.h (bignum_from_uintptr, c_uint_ptr_num): Declared. * eval.c (eval_init): Register random-state-get-vec. * mpi/mpi.c (mp_set_uintptr, mp_get_uintptr): New functions. (mp_set_intptr, mp_get_intptr): Expressed in terms of mp_set_uintptr and mp_get_uintptr. * mpi/mpi.h (mp_set_uintptr, mp_get_uintptr): Declared. * rand.c (make_random_state): Handle vector seed. (random_state_get_vec): New function. * rand.h (random_state_get_vec): Declared. * txr.1: Documented new feature in make-random-state and new random-state-get-vec function.
* Don't allow non-positive modulus in rand and random.Kaz Kylheku2016-01-181-0/+7
| | | | | | | | | | * rand.c (random): In fixnum case, allow only m >= 1. The code is restructured so that this check is done before we do some arithmetic with derived values, where the behavior can become undefined. * txr.1: Document the restriction on modulus range for rand and random.
* New function, split*.Kaz Kylheku2016-01-171-3/+15
| | | | | | | | | | | | | | | | | | * eval.c (eval_init): Register split*. * lib.c (split_star_func): New static function. (partition_split_common): Take pointer-to-function argument instead of boolean. Hoist this C function into the lazy cons. (partition): Pass pointer to partition_func ito partition_split_common, intsead of a flag requesting the use of partition_func. (split): Pass apointer to split_func into partition_split_common. (split_star): New function. * lib.h (split_star): Declared. * txr.1: Documented split*.
* Fix incorrect split examples.Kaz Kylheku2016-01-171-3/+3
| | | | | | | * txr.1: examples were calling split as if it were variadic, accepting multiple indices as separate arguments. This is not the case; a sequence of indices must be passed as one argument.
* Version 132.txr-132Kaz Kylheku2016-01-151-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* New :mandatory keyword in until/last clauses.Kaz Kylheku2016-01-151-1/+64
| | | | | | | | | | | | | | | | | | | * match.c (mandatory_k): New keyword variable. (h_coll, v_gather, v_collect): Implement :mandatory logic. (syms_init): Initialize mandatory_k. * parser.l (grammar): The UNTIL and LAST tokens must be matched similarly to collect, without consuming the closing parenthesis, allowing a list of items to be parsed between the symbol and the closure, in the NESTED state. * parser.y (gather_clause, collect_clause, elem, repeat_parts_opt, rep_parts_opt): Adjust to new until/last syntax. In the matching productions, the abstract syntax changes to incorporate the options. In the output productions, we throw an error if options are present. * txr.1: Documented :mandatory for collect, coll and gather.
* Fix omission: the / function becomes n-ary.Kaz Kylheku2016-01-131-2/+6
| | | | | | | | | | * eval.c (eval_init): Register / function to divv instead of divi. * lib.c (divv): New function. * lib.h (divv): Declared. * txr.1: Documented.
* The identity function gets an alias: use.Kaz Kylheku2016-01-131-1/+22
| | | | | | * eval.c (eval_init): Register "use" as alias for identity. * txr.1: Documented use function.
* Support crypt function.Kaz Kylheku2016-01-131-0/+27
| | | | | | | | | | * configure: Check for availability of crypt, and what library must be used. * sysif.c (crypt_wrap): New static function. (sysif_init): Register crypt intrinsic. * txr.1: Documented crypt.
* Version 131.txr-131Kaz Kylheku2016-01-121-2/+2
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise.
* Version 130.txr-130Kaz Kylheku2016-01-051-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Bad formatting under data directive.Kaz Kylheku2016-01-051-1/+1
| | | | txr.1: Improperly closed .cblk around example.
* Clarify same-sequence semantics of swap, rotate, shift.Kaz Kylheku2016-01-041-0/+42
| | | | | | * txr.1: Document what happens, or else what isn't specified, if swap, rotate or shift are used on ranges of the same sequence.
* Revert chr-isdigit/isxdigit, provide new functions.Kaz Kylheku2016-01-041-8/+18
| | | | | | | | | | | | | | | | | | | It was a mistake to change the semantics of the return value of chr-isdigit and chr-isdigit. It breaks code like [partition-by chr-isdigit ...]. The behavior of chr-isdigit and chr-isxdigit is restored to returning t and nil. New chr-digit and chr-xdigit functions are introduced for returning the digit value or nil. * eval.c (eval_init): Register chr-digit and chr-xdigit intrinsics. * lib.c (chr_isdigit, chr_isxdigit): Restore old behavior. (chr_digit, chr_xdigit): New functions. * lib.h (chr_digit, chr_xdigit): Declared. * txr.1: Everything documented.
* defstruct: order function slots before other static slots.Kaz Kylheku2016-01-031-0/+31
| | | | | | | | | | | | | | | | | This allows the initializer expressions for static slots to instantiate objects, and those instances can rely on methods being set up. * share/txr/stdlib/struct.tl (sys:prune-nil-inits): Recognize :function keyword as denoting a static slot. (defstruct): Represent methods and functions as (:function ...) items rather than (:static ...) so they can be distinguished. Function slots appear before other static slots in the static slot list, and their initializing code is placed into the the static-initfun lambda of the sys:make-struct-type call in this order. * txr.1: Documented.
* Bad formatting under destruct.Kaz Kylheku2016-01-021-1/+1
| | | | * txr.1: Missing .desc macro call.
* Bad formatting under RangesKaz Kylheku2016-01-021-0/+3
| | | | * txr.1: Add missing .desc macro invocations.
* Record-delimiting stream adapter.Kaz Kylheku2016-01-011-0/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | * regex.c (read_until_match): New function. (regex_init): Registered read-until-match intrinsic. * regex.h (read_until_match): Declared. * stream.c (struct delegate_base): New struct type. (delegate_base_mark, delegate_put_string, delegate_put_char, delegate_put_byte, delegate_get_char, delegate_get_byte, delegate_unget_char, delegate_unget_byte, delegate_close, delegate_flush, delegate_seek, delegate_truncate, delegate_get_prop, delegate_set_prop, delegate_get_error, delegate_get_error_str, delegate_clear_error, make_delegate_stream): New static functions. (struct record_adapter_base): New struct type. (record_adapter_base_mark, record_adapter_mark_op, record_adapter_get_line): New static functions. (record_adapter_ops): New static structure. (record_adapter): New function. (stream_init): Registered record-adapter intrinsic. * stream.h (record_adapter): Declared. * txr.1: Documented read-until-match and record-adapter.
* Copyright year bump.Kaz Kylheku2015-12-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * LICENSE, METALICENSE, Makefile, args.c, args.h, arith.c, arith.h, cadr.c, cadr.h, combi.c, combi.h, configure, debug.c, debug.h, eval.c, eval.h, filter.c, filter.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h, jmp.S, lib.c, lib.h, lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h, parser.l, parser.y, rand.c, rand.h, regex.c, regex.h, share/txr/stdlib/cadr.tl, share/txr/stdlib/except.tl, share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl, share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl, share/txr/stdlib/struct.tl, share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl, share/txr/stdlib/with-resources.tl, share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl, signal.c, signal.h, stream.c, stream.h, struct.c, struct.h, sysif.c, sysif.h, syslog.c, syslog.h, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h: Add 2016 copyright. * linenoise/LICENSE, linenoise/linenoise.c, linenoise/linenoise.h: Bump one principal author's copyright from 2014 to 2015. The code is based on a snapshot of 2015 upstream work.
* linenoise: submit and stay in history.Kaz Kylheku2015-12-311-0/+14
| | | | | | | | | | * linenoise/linenoise.c (struct lino_state): New member save_hist_idx. (edit): If save_hist_idx is set, jump to that history position and clear it. Handle ENTER in extended (Ctrl-X) mode similarly to regular ENTER, but setting save_hist_idx. * txr.1: Documented.
* Version 129.txr-129Kaz Kylheku2015-12-291-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* New variables for floating-point printing control.Kaz Kylheku2015-12-281-14/+70
| | | | | | | | | | | | | | | | | * lib.c (obj_print_impl): Instead of hard-coded "~s", obtain the format string for floats from the *print-flo-format* special variable, whose default value is "~s". * stream.c (print_flo_digits_s, print_flo_format_s): New symbol variables. (formatv): Use *print-flo-digits* value for default precision for ~f and ~e, rather than hard-coded 3. (stream_init): Initialize print_flo_digits_s and print_flo_format_s, and register special variables under those symbols. * stream.h (print_flo_digits_s, print_flo_format_s): Declared. * txr.1: Documented new specials.
* Adding with-slots macro.Kaz Kylheku2015-12-271-0/+88
| | | | | | | | | * lisplib.c (place_set_entries): Add with-slots to autoload name list. * share/txr/stdlib/struct.tl (with-slots): New macro. * txr.1: Documented.
* TXR quasiliterals and output vars treated as Lisp.Kaz Kylheku2015-12-261-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * eval.c (format_field): Function moved here from match.c, along with the introduction of a new behavior: if a meta-expr occurs among the modifiers, its constituent expression is evaluated in its place. This allows for @{a @[expr]} which was previously not allowed in Lisp quasiliterals, but worked in TXR quasiliterals due to the treatment of @ by txeval. (subst_vars): Static function turns external, so code in match.c can call it instead of the subst_vars in that module. For that purpose, it needs to take a filter argument and process filters, like the match.c subst_vars. (op_quasi_lit): Pass nil as filter argument to subst_vars. * eval.h (format_field, subst_vars): Declared. * match.c (format_field): Function removed, moved to eval.c and slightly changed. (subst_vars): Renamed to tx_subst_vars. By default, now just a wrapper for subst_vars. In compatibility mode, invokes the old logic. (do_txeval, do_output_line): Call tx_subst_vars rather than subst_vars. * match.h (format_field): Declaration removed. * parser.y (expr): Grammar production removed: no longer referenced. (o_var): Braced variable case now parsed as n_expr, and expanded as expr by default, since this is Lisp now. In compatibility mode, expanded using expand_meta. Also SYMTOK case must be subject to expansion; an output var can now be a symbol macro. (expand_meta): Expand a quasi-literal as Lisp, except in compatibility mode. * txr.1: Bit of a documentation update. Existing doc isn't totally clear.
* chr-isdigit and chr-isxdigit return value.Kaz Kylheku2015-12-231-13/+22
| | | | | | | | * lib.c (chr_isdigit, chr_isxdigit): Return the integer value rather than the symbol t, which can be exploited to write more compact scanning code. * txr.1: Documented.
* Base value in :counterKaz Kylheku2015-12-231-2/+15
| | | | | | | * match.c (do_output_line, do_output): Decode (var expr) syntax as argument of :counter and implement displacement. * txr.1: Documented.
* Section reference correction.Kaz Kylheku2015-12-231-1/+3
| | | | * txr.1: There is no Collect Keywords section.
* New directives @(data) and @(name)Kaz Kylheku2015-12-221-0/+109
| | | | | | | | | | | * match.c (data_s, name_s): New symbol variables. (v_data, v_name): New static functions. (syms_init): Initialize data_s and name_s. (dir_tables_init): Register v_data and v_name as vertical directives, and enable them in horozintal context too using hv_trampoline. * txr.1: Documented.
* Version 128.txr-128Kaz Kylheku2015-12-191-2/+2
| | | | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. Bumped copyright year in configure. (Could be last chance this year). * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Keep summary of place forms up-to-date.Kaz Kylheku2015-12-181-3/+15
| | | | | * txr.1: Add the cadr functions, rest, first through tenth, nthcdr and symbol-value.
* New condlet macro; small change to iflet/whenlet.Kaz Kylheku2015-12-181-6/+110
| | | | | | | | | | | | | | | | | | | | | | | * eval.c (me_iflet_whenlet): Allow the test form to be an atomic expression instead of bindings. This allows iflet to be used as the sole target construct of condlet, while allowing condlet to have a fallback clause with t. It also means that an empty list of bindings is allowed (since it is the atom nil). * lisplib.c (ifa_set_entries): Add "condlet" to the autoload names for the ifa module. That's where we are adding condlet. * share/txr/stdlib/ifa.tl (sys:if-to-cond): New macro expander helper function, generalizing the writing cond-like macros based on if-like operators. (conda): Rewritten using sys:if-to-cond. (condlet): New macro. * txr.1: Documented change in iflet/whenlet. Documented condlet.
* Revise Conventions slightly.Kaz Kylheku2015-12-181-5/+7
| | | | | * txr.1: Redundant item removed from Conventions. Indicate that braces may be removed where it is clear.
* New --debug-expansion option.Kaz Kylheku2015-12-181-1/+7
| | | | | | | | | | | | | * txr.c (opt_dbg_expansion): New global variable. (help): Print summary for --debug-expansion. (txr_main): Recognize new option and set flag. * parser.y (parse_once): Suppress debug stepping around parser if opt_dbg_expansion is false. * txr.1 (opt_dbg_expansion): Declared. * txr.1: Documented new option.
* Useful feature: object post-initialization.Kaz Kylheku2015-12-161-3/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Structs can now have code which executes after an object is initialized, which is useful for doing work like registering objects in global lists and whatever, when those actions need access to the initialized slots of the object. * share/txr/stdlib/struct.tl (defstruct): Handle :posinit syntax, by generating lambda as eighth argument of sys:make-struct call. * struct.c (struct struct_type): New member, postinitfun. (struct_init): Adjust registrations of make_struct_type to account for new parameter. The user visible make-struct-type is registered as having one optional argument, for backward compat. (make_struct_type): New argument, postinitfun. Store this in the structure. For backward compatibility, the argument is defaulted. (struct_type_mark): Mark the new postinitfun member. (call_postinitfun_chain): New static function. (make_struct, lazy_struct_init): Call call_postinitfun_chain after slots are initialized, and after the boa function is called. * struct.h (make_struct_type): Declaration updated. * lib.c (time_init): Pass eighth argument to make_struct type. * sysif.c (sysif_init): Likewise. * unwind.c (uw_late_init): Likewise. * tests/012/struct.tl: Update defstruct expansion test case. * txr.1: Document new argument of make-struct-type, and clarify ordering of initfun with regard to other actions. Likewise, document :postinit, and clarify ordering of :init actions with regard to other actions.
* HTML doc: markup in lower case.Kaz Kylheku2015-12-151-1/+1
| | | | | | | | Requires updated man2html which puts out lower case. * genman.txr: All matched and generated HTML is lower case. * txr.1 (NP*): Use lower case h4 tag in M2SS macro.
* Improved documentation of macro parameter lists.Kaz Kylheku2015-12-141-18/+64
| | | | | | * txr.1: Improved wording, better explanation, explanation that nested macro lists support all features, and specified meaning of :whole inside nested lists.
* Pluralization under Equality Substitution.Kaz Kylheku2015-12-131-1/+1
| | | | * txr.1: "unless they are the same object."