summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
...
* doc: defsymacro rewording.Kaz Kylheku2016-10-141-8/+12
| | | | | * txr.1: Updating awkward wording, beginning with clumsy two-clause sentence joined by a colon.
* doc: small fix under format ~s directive.Kaz Kylheku2016-10-141-1/+3
| | | | | * txr.1: typeset print function name with .code so it turns to typewriter font and hyperlink.
* Adding family slot to socket addresses.Kaz Kylheku2016-10-131-4/+28
| | | | | | | | | | | | | | | A static slot indicating the address family simplifies code which wants to map a socket address to its family. * lisplib.c (sock_instantiate): Call sock_load_init before loading socket.tl rather than after, because socket.tl now references variables defined inside sock_load_init. * share/txr/stdlib/socket.tl (sockaddr, sockaddr-in, sockaddr-in6, sockaddr-un): New static slot, family. * txr.1: Documented family slots.
* doc: clarification under nullify method.Kaz Kylheku2016-10-131-1/+2
| | | | | | * txr.1: the nullify method need not return the object itself in the non-empty case; it may also return a sequence.
* find-max and find-min support hashes.Kaz Kylheku2016-10-121-2/+21
| | | | | | | * lib.c (find_max): Restructured to implement separately for vectors and lists. Support hash tables. * txr.1: Document find-min and find-max for hashes.
* New accessor: hash-userdata.Kaz Kylheku2016-10-121-7/+36
| | | | | | | | | | | | | | The get-hash-userdata function is now deprecated in favor of hash-userdata, which is an accessor. * hash.c (hash_init): Register hash-userdata as a synonym for the same function as get-hash-userdata. * share/txr/stdlib/place.tl (hash-userdata): New defplace. * txr.1: Document new accessor, marking get-hash-userdata as a deprecated synonym. Replace references to get-hash-userdata with references to hash-userdata.
* Include user data in hash read syntax.Kaz Kylheku2016-10-121-6/+24
| | | | | | | | | | | | | * hash.c (userdata_k): New keyword symbol variable. (hash_print_op): Print the userdata together with the hash flags as :userdata obj. (hashv): Parse out :userdata obj syntax from the argument list. This takes care of supporting it in the read notation and in the hash function. (hash_init): Initialize userdata_k. * txr.1: Documenting :userdata in hash read notation and hash function.
* Support gmtoff and zone in time struct.Kaz Kylheku2016-10-121-2/+34
| | | | | | | | | | | | | | * lib.c (gmtoff_s, zone_s): New symbol variables. (tm_to_time_struct): Copy tm_gmtoff and tm_zone into Lisp struct from struct tm, if the platform has these. (time_fields_to_tm): Zero/null-out the tm_gmtoff and tm_zone fields of the target structure, if the platform has them. (time_init): Intern the gmtoff and zone symbols, initializing the gmtoff_s and zone_s variables. Add the gmtoff and zone slots to the time struct. * txr.1: Documented new slots.
* doc: typo under html-encode*Kaz Kylheku2016-10-121-1/+1
| | | | * txr.1: necessary -> necessarily
* New function regex-from-trie.Kaz Kylheku2016-10-121-0/+28
| | | | | | | * filter.c (regex_from_trie): New static function. (filter_init): Register regex-from-trie intrinsic. * txr.1: Documented regex-from-trie.
* Support curried args in method and meth.Kaz Kylheku2016-10-091-15/+75
| | | | | | | | | | | | | | | | | | | | | * share/txr/stdlib/struct.tl (meth): Take trailing arguments and pass them down to method, which now accepts them. * struct.c (struct_init): Register method intrinsic to the function method_args instead of the method function. (method_args_fun): New static function. (method_args): New function. Behaves like method function if args is empty, otherwise creates a function by means of method_args_fun. * struct.h (method_args_fun): Declared. * tests/012/oop.tl: New test case. * tests/012/oop.expected: Updated. * txr.1: Documented new features in method and meth, revising the documentation in the process.
* Support curried arguments in umethod and umeth.Kaz Kylheku2016-10-091-8/+28
| | | | | | | | | | | | | | | | | | | | | | | | * share/txr/stdlib/struct.tl (umeth): accept variadic arguments. Evaluate them using the dwim brackets and pass to umethod. The (fun umethod) trick is used to refer to the umethod in the function namespace even if it is shadowed by a variable. * struct.c (struct_init): Update registration of umethod to reflect its new variadic argument signature. (umethod_args_fun): New static function. (umethod): Return a function based on umethod_fun, as before, if there are no variadic args. Otherwise, use umethod_args_fun which deals with them. * struct.h (umethod): Declaration updated. * tests/012/oop.tl: Modest testcase for umeth with curried argument. * tests/012/oop.expected: Updated. * txr.1: Updated documentation of umeth and umethod.
* Version 153.txr-153Kaz Kylheku2016-10-071-2/+2
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise.
* Check for self-assignment in replace_struct.Kaz Kylheku2016-10-071-0/+11
| | | | | | | | | * struct.c (replace_struct): If target and source are the same object, just do nothing and return target. * txr.1: Document self-assignment and return value of replace-struct.
* doc: mistakes in introduction of do operator.Kaz Kylheku2016-10-071-3/+3
| | | | | | * txr.1: Where do is being introduced, fix a statement that about op, which should be about do. Plus fix verb agreement.
* Version 152.txr-152Kaz Kylheku2016-10-041-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* doc: ranges are immutable.Kaz Kylheku2016-10-041-2/+5
| | | | | * txr.1: document that ranges are immutable and expand the surrounding wording a bit.
* doc: small change under defstruct.Kaz Kylheku2016-10-041-1/+1
| | | | | * txr.1: describe slot specifier as (name init-form) rather than (symbol init-form).
* length and empty functions support ranges.Kaz Kylheku2016-10-041-11/+60
| | | | | | * lib.c (length, empty): Handle RNG in switch. * txr.1: Documented.
* New awk clauses :set and :set-file.Kaz Kylheku2016-10-041-3/+20
| | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-expander): Recognize :set and :set-file cases. * txr.1: Documented :set and :set-file, replacing some :begin uses with :set in the examples.
* New function rra.Kaz Kylheku2016-10-031-0/+61
| | | | | | | | | * regex.c (range_regex_all, regex_range_all): New functions. (regex_init): Register rra intrinsic function. * regex.c (range_regex_all, regex_range_all): Declared. * txr.1: Documented rra.
* New rr function.Kaz Kylheku2016-10-031-5/+49
| | | | | | | | | | * regex.c (regex_range_search): New function. (regex_init): Register regex_range_search as rr intrinsic. * regex.h (regex_range_search): Declared. * txr.1: Documented rr, and added reference to it in description of regex-range.
* search-regex improvement: negative start and more.Kaz Kylheku2016-10-031-8/+58
| | | | | | | | | | | | * regex.c (search_regex): Handle negative starting positions according to the convention elsewhere and fail excessively negative ones. Consistently fail on starting positions exceeding the length of the string. Handle zero length matches by reporting them against the start position or position one past the last character, based on the value of from-end. * txr.1: search-regex documentation updated.
* doc: missing documentation on less over ranges.Kaz Kylheku2016-10-031-2/+22
| | | | | | * txr.1: Document how the less function operates on ranges, and that ranges rank between numbers and strings on the comparison precedence for dissimilar types.
* doc: update less on vectors text.Kaz Kylheku2016-10-031-3/+8
| | | | | * txr.1: Improve wording in the description of how the less function operates on vectors.
* Support arithmetic operations on ranges.Kaz Kylheku2016-10-021-0/+105
| | | | | | | * arith.c (plus, minus, neg, abso, mul, trunc, divi, zerop, gt, lt, ge, le, numeq): Support RNG type. * txr.1: Documented arithmetic properties of ranges.
* Synchronize license comments with LICENSE.Kaz Kylheku2016-10-011-18/+19
| | | | | | | | | | | | | | | | | | | | * 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, ftw.c, ftw.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/awk.tl, share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl, share/txr/stdlib/conv.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/socket.tl, share/txr/stdlib/struct.tl, share/txr/stdlib/termios.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, socket.c, socket.h, stream.c, stream.h, struct.c, struct.h, sysif.c, sysif.h, syslog.c, syslog.h, termios.c, termios.h, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h: Revert to verbatim 2-Clause BSD.
* doc: two "a any" typos.Kaz Kylheku2016-10-011-2/+2
| | | | | * txr.1: fix one "a any" in structs and one in notes on exotic regexes.
* Revision of static slot inheritance.Kaz Kylheku2016-09-301-64/+219
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixing the broken static slot handling in TXR Lisp's "OOP structs" object system. Inherited static slots are now shared with the base type; only static slots explicitly defined in a derived type have a distinct global instance in that type. * share/txr/stdlib/struct.tl (sys:prune-nil-inits): Function removed. (sys:prune-missing-inits): New function. We now handle static slot forms with missing inits specially, not those with nil or missing inits. (defstruct): Translate a (word name) form to (word name) rather than (word name nil) if word is :static, because we need this nuance for non-shared static slots, so they can inherit the value from the base struct. For the purposes of generating the static init function, prune away all the static slot forms that do not have an initializer; we let those default. * struct.c (struct stslot): New struct for representing a static slot. (stslot_loc, stslot_place): New macros. (struct struct_type): Member eqmslot changes to a pointer to a struct stslot. The stslot dynamic array is no longer an array of val, but an array of stslot structs. (call_stinitfun_chain): The superclass chain of static init functions is now called only in compatibility mode. Otherwise only the type's own static init fun is called, which defclass uses to initialize just the new or repeated static slots. Inherited static slots are completely left alone; they do not require initialization. (static_slot_home_fixup): New static function; needed to fix some internal pointers within the static slot arrays if they are realloc'ed. (make_struct_type): Considerably revised to implement new scheme, while providing backward compatibility switching. New slots live in the struct stslot in which they are allocated. Inherited slots have home pointers to within the array in the base. (struct_type_mark): When walking the static slots, mark only the store cells of those which live in this array. Those that live elsewhere should have store cells that are nil; let's assert on it. (lookup_slot): Static slot lookup code has to retrieve slots in the new way, indirecting through the home pointer, which is hidden behind the stslot_loc macro. (lookup_static_slot_desc): New function, like lookup_static_slot, but returning a pointer to the struct stslot. Formed from the guts of lookup_static_slot. (lookup_static_slot): Gutted and turned into a wrappar around lookup_static_slot_desc. (static_slot_set): Simple change here: add cast because of the pointer type of eqmslot. (static_slot_home_fixup_rec): New static function. Fixes up the cached home in slot arrays in an entire type hierarchy rooted at a given type, which has to be done when its static slot has been reallocated, so all those inherited static slot pointers in the derived types are invalid. (static_slot_rewrite_rec): New static function: rewrites a particular inherited static slot in an inheritance hierarchy to point to a different slot. (static_slot_ens_rec): New static function: factored out recursive logic of static_slot_ensure. Substantially rewritten to handle new static slot scheme, plus support backward compatibility. There is a bug fixed here: if an instance slot is encountered in the no_error_p mode, it looks like we were dereferencing through an invalid ptr through the set(ptr, newval) line. (static_slot_ensure): A wrapper now for static_slot_ens_rec. (get_equal_method): Rework the logic related to the eqmslot member of the struct_type structure, in terms of it being a pointer now rather than an integer. The value -1 cast to a pointer serves the previous -1 sentinel value which indicates that it is confirmed (for the time being) that this type doesn't have an equal method. * txr.1: All documentation related to static slots updated, and compatibility notes added. * tests/012/oop.tl, tests/012/oop.expected: New files.
* Version 151.txr-151Kaz Kylheku2016-09-271-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Change criterion for *load-path*-relative loading.Kaz Kylheku2016-09-271-4/+8
| | | | | | | | | | * eval.c (load): Do not resolve all relative paths relative to the current *load-path*, only pure relative ones. * match.c (v_load): Likewise. * txr.1: Update doc for @(load)/@(include) and load function.
* New function pure-rel-path-p.Kaz Kylheku2016-09-271-2/+48
| | | | | | | | | * stream.c (plp_regex): New static variable. (pure_rel_path_p): New function. (stream_init): gc-protect plp_regex. Register pure-rel-path-p intrinsic. * txr.1: Document pure-rel-path-p and slightly revise abs-path-p.
* Get rid of sys:load; load becomes function.Kaz Kylheku2016-09-261-2/+2
| | | | | | | | | | | | | | | | | * eval.c (sys_load_s): Variable removed. (sys_load): Function removed. (load): Body of function taken from sys_load. There is no sloc argument; the *load-path* variable is sampled via new load_path macro. (me_load): Static function removed. (eval_init): Remove initialization of sys_load_s Remove registration of load macro and sys:load function. Register load function. * eval.h (load_path): New macro. * txr.1: Change documentation of load from macro to function.
* Overhaul of self-load-path mechanism.Kaz Kylheku2016-09-261-42/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The self-load-path symbol macro is as of now deprecated. It simply expands to *load-path*. *load-path* is a new special variable which is dynamically bound to the path of a file being loaded. * eval.c (self_load_path_s): Global variable renamed to load_path_s. (sys_load): Bind *load-path* around processing of loaded file. (me_load): Expand (load x) simply to (sys:load x *load-path*). (set_get_symacro): Function removed. (reg_symacro): New static function. (eval_init): Initialize renamed load_path_s with interned symbol having the name *load-path*. Register the *load-path* special variable. Set up the sel-load-path symbol macro aliasing for *load-path*. * eval.h (self_load_path_s): Declaration renamed. * match.c (v_load): Bind *load-path* around loading or inclusion. * parser.c (load_rcfile): Bind *load-path* around loading of .txr_profile file. * txr.c (txr_main): Bind *load-path* instead of self-load-path symbol macro. * txr.1: Updated documentation for @(load) directive and load macro. Replaced documentation of self-load-path with *load-path*.
* doc: new regsub example.Kaz Kylheku2016-09-261-0/+3
| | | | * txr.1: Left-anchored match in regsub with r^.
* doc: regex examples.Kaz Kylheku2016-09-251-0/+21
| | | | * txr.1: Examples for f^$, f^ and f$.
* doc: fconv examples.Kaz Kylheku2016-09-251-0/+25
| | | | * txr.1: New examples for awk macro fconv.
* awk macro: proper fs semantics in paragraph mode.Kaz Kylheku2016-09-251-17/+12
| | | | | | | | | | | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-state): New slots: par-mode, par-mode-fs, par-mode-prev-fs. (sys:awk-state rec-to-f): In paragraph mode, detect that fs has changed since the last call. In that case, take the user's fs and add to it a newline match. If it is a regex, take the source, add the syntax and recompile the regex. If it's a string, build regex around it and compile. (sys:awk-state loop): Maintain the par-mode-t variable in the state structure as the rs value triggers transitions into or out of paragraph mode. * txr.1: Updated documentation for rs.
* New function: regex-source.Kaz Kylheku2016-09-251-0/+15
| | | | | | | | | * regex.c (regex_source): New function. (regex_init): regex-source intrinsic registered. * regex.h (regex_source): Declared. * txr.1: Documented.
* awk macro: support paragraph mode.Kaz Kylheku2016-09-251-0/+35
| | | | | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-state loop): If the rs variable is nil, provide a record reader which reads paragraphs, like under Awk's paragraph mode when RS is blank. This does not support the requirement that newline is always a field separator, regardless of the value of FS. * txr.1: Documented paragraph mode.
* awk macro: handle dynamic changes in rs variable.Kaz Kylheku2016-09-251-0/+12
| | | | | | | | * awk.tl (sys:awk-state loop): The loop now notices when rs or krs changes and switches to a new record-adapter or to the raw stream as necessary. * txr.1: Notes added about changes to rs and krs.
* New strlist list input stream type.Kaz Kylheku2016-09-241-0/+12
| | | | | | | | | | | | | | | | | | * stream.c (struct strlist_in): New struct type. (strlist_in_stream_mark, strlist_in_get_line, strlist_in_get_char, strlist_in_unget_char, strlist_in_get_prop, strlist_in_get_error_str): New static functions. (strlist_in_ops): New static struct. (make_strlist_input_stream): New function. (stream_init): Register make-strlist-input-stream intrinsic. * stream.h (make_strlist_input_stream): Declared. * txr.1: Documented make-strlist-input-stream. Call fill_stream_ops on new strlist_in_ops struct to fill in common default stream operations.
* doc: add to fconv documentation.Kaz Kylheku2016-09-241-0/+14
| | | | | * txr.1: Documenting effect of fconv on rec, and its return value.
* doc: take advantage of orec in awk example.Kaz Kylheku2016-09-241-0/+7
| | | | | * txr.1: POSIX-derived example 1 can be made to conform to the original with orec.
* awk macro: add orec variable.Kaz Kylheku2016-09-241-1/+28
| | | | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-state): New slot, orig-rec. (sys:awk-state loop): Initialize orig-rec after reading each record. (sys:awk-let): Provide orec symbol macro. * txr.1: Document orec variable.
* doc: add awk macro examples.Kaz Kylheku2016-09-241-0/+213
| | | | | * txr.1: Adding 19 examples, converted from POSIX standard's Awk eamples.
* awk macro: use range test logic for clause conditions.Kaz Kylheku2016-09-241-1/+11
| | | | | | | | | | | * share/txr/stdlib/awk.tl (sys:range-test): Function renamed to sys:awk-test, since it's not just for ranges. (sys:awk-let): Uses of sys:range-test follow rename. sys:awk-test introduced into expansion of cond parts of cond-action clauses. * txr.1: Documented new behavior (conditions can produce a function or regex, which is implicitly invoked on rec).
* doc: use .coSS only for headings with identifiers.Kaz Kylheku2016-09-241-2/+2
| | | | * txr.1: Change .coSS to .SS* in two places.
* awk macro: fconv conversions iz, xz, oz, bz and rz.Kaz Kylheku2016-09-241-0/+16
| | | | | | | * share/txr/stdlib/conv.tl (sys:conv-let): New flets iz, oz, xz, bz and rz. * txr.1: Documented under fconv.
* New functions: tofloatz and tointz.Kaz Kylheku2016-09-241-0/+43
| | | | | | | | | | * arith.c (tofloatz, tointz): New functions. * arith.h (tofloatz, tointz): Declared. * eval.c (eval_init): Register tofloatz and tointz intrinsics. * txr.1: Documented new functions.