summaryrefslogtreecommitdiffstats
path: root/share
Commit message (Collapse)AuthorAgeFilesLines
* symbol-function semantics change; new symbol-macro.Kaz Kylheku2015-12-101-0/+16
| | | | | | | | | | | | | | | | | | | | | | | * eval.c (symbol_function): Only retrieve function binding, and not macro or operator bindings, unless compatibility <= 127 is in effect. (symbol_macro): New function. (fboundp): Only test for existence of function, not macro or operator, unless <= 127 compatibility is in effect. (fmakunbound): Do not remove macro binding, unless compatibility <= 127 is in effect. (eval_init): Register sys:top-mb variable for use in place.tl library module. Register symbol-macro intrinsic function. * share/txr/stdlib/place.tl (sys:get-mb): New function (symbol-macro): New syntactic place. * txr.1: Updated incorrect documentation about environments from the perspective that macros and functions coexist. Documented symbol-macro. Updated symbol-function, fboundp and fmakunbound documentation. Added missing documentation for mmakunbound. Reference to fboundp under define-place-macro revised to mboundp. Added compatibility notes.
* Version 127.txr-127Kaz Kylheku2015-12-091-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* defmeth returns compound method name.Kaz Kylheku2015-12-091-1/+1
| | | | | * share/txr/stdlib/struct.tl (sys:defmeth): Return compound method name as return value: (meth <type> <name>).
* Bugfix: ifa must allow dwim expressions.Kaz Kylheku2015-12-091-3/+6
| | | | | | | | * share/txr/stdlib/ifa.tl (ifa): Accept dwim expressions as the condition. Moreover, treat [f x] as a one-argument call, even though it is the two-argument form (dwim f x). * txr.1: Documented.
* Correct return value of defmeth.Kaz Kylheku2015-11-301-3/+4
| | | | | * share/txr/stdlib/struct.tl (defmeth): Return the symbol being defined.
* Version 126.txr-126Kaz Kylheku2015-11-291-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Bugfix: sethash doesn't return stored value.Kaz Kylheku2015-11-251-7/+11
| | | | | | | | | | | | | | | | sethash mistakenly returns a boolean which indicates that the value was newly added, rather than the documented behavior of returning the new value. * hash.c (sethash): return value rather than new_p. * share/txr/stdlib/place.tl (defplace): The defplace form now seturn the main symbol of the place being defined, rather than returning whatever the last sethash call returns. (define-place-macro): Likewise. (sys:register-simple-accessor): Likewise, so that defaccessor returns the getter function's name.
* Better no such type diagnostic in defmeth.Kaz Kylheku2015-11-251-5/+8
| | | | | | * share/txr/stdlib/struct.tl (sys:defmeth): New function. Reacts to find-struct-type returning nil. (defmeth): Logic moved into function.
* New macro define-accessor.Kaz Kylheku2015-11-251-0/+19
| | | | | | | | | | | * lisplib.c (place_set_entries): New entry to trigger autoloading for define-accessor. * share/txr/stdlib/place.tl (sys:register-simple-accessor): New function. (define-accessor): New macro. * txr.1: Documented define-accessor.
* Version 125.txr-125Kaz Kylheku2015-11-201-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Introducing lazy structs.Kaz Kylheku2015-11-201-0/+12
| | | | | | | | | | | | | | | | | | | | | | | * share/txr/stdlib/struct.tl (lnew): New macro. * struct.c (struct_type): Turn id into a bitfield one bit smaller than cnum. New Boolean bitfield lazy. (struct_init): Register make-lazy-struct intrinsic. (make_struct): Initialize lazy bitfield to zero. (lazy_struct_init, check_init_lazy_struct): New static functions. (make_lazy_struct): New function. (copy_struct, clear_struct, replace_struct, reset_struct, lookup_slot, struct_inst_equal, struct_inst_hash): Call check_init_lazy_struct on all structures involved. (lookup_slot): Call check_init_lazy_struct. (struct_inst_mark): If the struct is lazy, it has one instance slot which must be marked, holding the argfun function passed into make_lazy_struct. * struct.h (make_lazy_struct): Declared. * txr.1: Documented lnew and make-lazy-struct.
* New uslot function and usl macro.Kaz Kylheku2015-11-201-0/+3
| | | | | | | | | | | | | | * struct.c (struct_init): Register uslot intrinsic function. (uslot_fun): New static function. (uslot): New function. * struct.h (uslot): Declared. * share/txr/stdlib/struct.tl (usl): New macro. * lisplib.c (struct_set_entries): Add usl macro. * txr.1: Documented uslot and usl.
* Version 124.txr-124Kaz Kylheku2015-11-141-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Version 123.txr-123Kaz Kylheku2015-11-061-1/+1
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise.
* Version 122.txr-122Kaz Kylheku2015-11-051-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* yield-from can omit form; access initial value.Kaz Kylheku2015-11-041-13/+25
| | | | | | | | | | | | | * share/txr/stdlib/yield.tl (sys:rcv-item): New struct type. (sys:obtain-impl): Handle rcv-item, produced by a no-argument yield-from, which requests an immediate resumption with the previously given resume value. The reply value is renamed the resume value. (yield-from, yield): Form argument is optional. * txr.1: Rewrote obtain and yield documentation with lesser focus on implementation and greater focus on abstract semantics.
* Moving sys:capture-cont to call/cc style API.Kaz Kylheku2015-11-021-18/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * unwind.c (revive_cont): Don't wrap cons cell around passed arg; just pass it directly. We don't need that convention any more. * capture_cont: Take functional argument. Pass the captured continuation to the function. If the function returns, return whatever it returned. When resuming, return the continuation argument. (uw_capture_cont): Take functional second argument and pass to capture_cont. Context form becomes third argument. (uw_late_init): Update registration of sys:capture-cont to three arguments, two required. * unwind.h (uw_capture_cont): Declaration updated. * share/txr/stdlib/yield.tl (sys:yield-impl): Not needed any more; all this was doing was implementing a call/cc style interface around sys:capture-cont which can now be used directly. (yield-from): Use sys:capture-cont directly. (suspend): Simplified to the point of triviality with new sys:capture-cont. * txr.1: Documented.
* Define suspend operator.Kaz Kylheku2015-10-301-0/+8
| | | | | | | | | | * lisplib.c (yield_set_entries): Added "suspend" to end of name. * share/txr/stdlib/yield.tl (suspend): New macro. * txr.1: Documented suspend. Replaced subtly incorect shift/reset implementation example with suspend implementation.
* Version 121.txr-121Kaz Kylheku2015-10-291-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Provide a way to free the continuation stacks.Kaz Kylheku2015-10-291-2/+5
| | | | | | | | | | | | | | | | | | * share/txr/stdlib/yield.tl (sys:obtain-impl): Pass sys:cont-free symbol to each abandoned continuation to release its stack buffer. (obtain): Handle the sys:cont-free symbol in the lambda, so the initial lambda can be treated uniformly with continuation functions. * txr.1: Documented sys:obtain-impl. * unwind.c (sys_cont_free_s): New symbol variable. (cont_mark): Check for null stack pointer and avoid marking. (revive_cont): If arg is sys:cont-free, then free the continuation and return nil. If the continuation has a null stack buffer, throw an error. (uw_late_init): Initialize sys_cont_free_s.
* Finalize obtain continuator function.Kaz Kylheku2015-10-291-7/+10
| | | | | | | | | | * share/txr/stdlib/yield.tl (sys:obtain-impl): Add a finalizer to the returned closure which will feed sys:cont-poison object to the most recently captured continuation. Thus abandoned obtain blocks which have become garbage shall have their unwinding performed. * txr.1: Documented the finalization behavior.
* Implementing sys:abscond-from operator.Kaz Kylheku2015-10-281-2/+3
| | | | | | | | | | | | | | | | | | | | | * eval.c (sys_abscond_from_s): New symbol variable. (op_abscond_from): New static function. (do_expand): Handle abscond-from like return-from. (eval_init): Initialize sys_abscond_from_s and register sys:abscond-from operator. * share/txr/stdlib/yield.tl (yield-from): Use sys:abscond-from instead of return-from, to avoid tearing down the continuation's resources that it may need when restarted. * txr.1: Documented sys:abscond-from and added a mention to the Delimited Continuations introduction. * unwind.c (uw_abscond_to_exit_point): New static function. (uw_block_abscond): New function. * unwind.h (uw_block_abscond): Declared.
* Add obtain/yield macros interface to continuations.Kaz Kylheku2015-10-281-0/+59
| | | | | | | | | | | * lisplib.c (yield_set_entries, yield_instantiate): New static functions. (dlt_register): Registered new functions. * share/txr/stdlib/yield.tl: New file. * txr.1: Documented obtain, yield-from, obtain-block and yield.
* Improvement in place macros.Kaz Kylheku2015-10-281-10/+15
| | | | | | | | | | | Expansion of places now gives priority to place macros. Moreover, it iterates over place macro and ordinary macro expansion. * share/txr/stdlib/place.tl (sys:trigger-load): Removed. (sys:pl-expand): Rewritten. * txr.1: Documented.
* Bugfix: incompletely implemented zap macro.Kaz Kylheku2015-10-251-2/+2
| | | | * share/txr/stdlib/place.tl (zap): Missing second argument.
* Version 120.txr-120Kaz Kylheku2015-10-181-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Adding defmeth macro and static-slot-ensure.Kaz Kylheku2015-10-161-0/+7
| | | | | | | | | | | | | | | | | * share/txr/stdlib/struct.tl (defmeth): New macro. * struct.c (struct struct_type): New member, dvtypes. (struct_init): Register static-slot-ensure intrinsic. (make_struct_type): Initialize dvtypes of newly instantiated struct_type struct. If a super is specified, add new type to the super's dvtypes. (struct_type_mark): Mark st->dvtypes. (static_slot_ensure): New function. * struct.h (static_slot_ensure): Declared. * txr.1: Documented defmeth and static-slot-ensure.
* Adding typecase macro.Kaz Kylheku2015-10-141-0/+38
| | | | | | | | | | * lisplib.c (type_set_entries, type_instantiate): New static functions. (lisplib_init): Register new functions in dl_table. * share/txr/stdlib/type.tl: New file, providing typecase * txr.1: Documented typecase.
* New way of handling exceptions without unwinding.Kaz Kylheku2015-10-141-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * eval.c (handler_bind_s): New symbol variable. (op_handler_bind): New static function. (do_expand): Traverse handler-bind forms. (eval_init): Initialize handler_bind_s variable and register handler-bind operator. * lisplib.c (except_set_entries, except_instantiate): New functions. (lisplib_init): Register new functions in dl_table. * parser.c (intr_s): New symbol variable. (repl_intr): Throw exception of type intr, rather than error. This way we can interrupt accidental exception handling loops involving exceptions derived from error. (parse_init): Initialize intr_s. * share/txr/stdlib/except.tl: New file, defines handle macro. * unwind.c (uw_push_handler): New function. (invoke_handler): New static function. (uw_throw): Search loop looks for and processes handlers in addition to catches. * unwind.h (uw_frtype_t): New enum member, UW_HANDLE. (struct uw_catch): Move member visible so it is in the same position as in struct uw_handler. (struct uw_handler): New struct type. (union uw_frame): New member ha of type struct uw_handler. (uw_push_handler): Function declared. * txr.1: Added introductory paragraphs to Exception Handling section. Documented handler-bind and handle. Some minor errors corrected.
* Hash table iterators exposed, with new macro.Kaz Kylheku2015-10-111-0/+41
| | | | | | | | | | | * eval.c (eval_init): Register hash-begin and hash-next intrinsics. * lisplib.c (hash_set_entries, hash_instantiate): New static functions. (lisplib_init): Register new tables in dl_table. * share/txr/stdlib/hash.tl: New file. * txr.1: Document with-hash-iter macro.
* Struct finalizers should be registered first.Kaz Kylheku2015-10-101-13/+13
| | | | | | | | | | | * share/txr/stdlib/struct.tl (defstruct): Rearrange the generated instance initialization function so that if a :fini block was specified, it is performed first. Thus if the remaining initialization code is abandoned, it is possible to intercept that and invoke the finalizer, which can clean up any mess left behind. * txr.1: Document changed order.
* defstruct bugfix: nonexistent function called.Kaz Kylheku2015-10-101-6/+6
| | | | | * share/txr/stdlib/struct.tl (defstruct): The nonexistent uw-throwf function was called instead of throw.
* Version 119.txr-119Kaz Kylheku2015-10-101-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* New macro: with-objects.Kaz Kylheku2015-10-101-0/+8
| | | | | | | | | | | * lisplib.c (with_resources_set_entries): "with-objects" added to name table. * share/txr/stdlib/with-resources.tl (with-objects): New macro. * txr.1: Documented with-objects. Added note to :fini specifier of defstruct pointing to call-finalizers and with-objects.
* Various stream-related with- macros introduced.Kaz Kylheku2015-10-081-0/+48
| | | | | | | | | | * lisplib.c (with_stream_set_entries, with_stream_instantiate): New static functions. (lisplib_init): Register new functions in dl_table. * share/txr/stdlib/with-stream.tl: New file. * txr.1: Documented new macros.
* Optional arguments in boa construction.Kaz Kylheku2015-10-041-5/+20
| | | | | | | | | | | | * share/txr/stdlib/struct.tl (defstruct): Split boa arguments on colon and generate the lambda accordingly. The generated function detects which optional arguments are actually present and only performs the slot updates for those. * tests/012/struct.tl: Corrected boa test case. * txr.1: Documented.
* slot-p renamed to slotp, conforming with Lisp conventions.Kaz Kylheku2015-10-031-1/+1
| | | | | | | | | | | | | | * share/txr/stdlib/struct.tl (sys:prune-nil-inits): Use of slot-p renamed. * struct.c (struct_init): Register slotp, and make registration of slot-p conditional on compatibility option. (slot_p): Function renamed to slotp. * struct.h (slot_p): Declaration renamed. * txr.1: References to slot-p fixed to slotp. Compat notes added.
* New umeth and umethod macro and function.Kaz Kylheku2015-10-031-0/+3
| | | | | | | | | | * share/txr/stdlib/struct.tl (umeth): New macro. * struct.c (struct_init): Registered umethod intrinsic. (umethod_fun): New static function. (umethod): New function. * txr.1: Documented.
* Optimization: elide some nil slot initializations.Kaz Kylheku2015-10-031-2/+13
| | | | | | | | | | | If a defstruct slot specifier calls for a slot to be initialized to nil, that doesn't have to be done explicitly if the slot isn't inherited. * share/txr/stdlib/struct.tl (sys:prune-nil-inits): New function. (defstruct): Use prune-nil-inits to try to reduce the lists of static and instance slot specifiers.
* Struct methods and functions set up named block.Kaz Kylheku2015-10-021-2/+6
| | | | | | | | * share/txr/stdlib/struct.tl (defstruct): Generate a named block around the body forms of the :method and :function lambdas, whose name matches the slot name. * txr.1: Documented.
* Version 118.txr-118Kaz Kylheku2015-10-011-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Support for reverse order in finalization.Kaz Kylheku2015-10-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | A new optional argument on finalize allows it to be expressed that multiple finalizers on the same object are to be called in reverse order, which is potentially for objects with inheritance. * gc.c (gc_finalize): New optional argument, rev_order_p. Insert at the head of the list if this argument is specified and true. (gc_late_init): Register finalize as three-argument function with optional argument. * gc.h (gc_finalize): Declaration updated. * share/txr/stdlib/struct.tl (defstruct): Register :fini functions in reverse, so that derived finalizers are called before supertype finalizers. * txr.1: Documented new finalize argument, and behavior of :fini.
* Better argument checking in new macro.Kaz Kylheku2015-09-301-0/+3
| | | | | | * share/txr/stdlib/struct.tl (new): Check that arguments occur pairwise instead of allowing an odd number to cause a puzzling error.
* Optimize empty lambdas in defstruct.Kaz Kylheku2015-09-301-15/+18
| | | | | | | * share/txr/stdlib/struct.tl (defstruct): Don't generate lambdas with empty body; just generate nil, which make-struct-type accepts. * tests/012/struct.tl: Updated defstruct expansion test.
* struct :init :fini specifiers.Kaz Kylheku2015-09-291-3/+35
| | | | | | | | * share/txr/stdlib/struct.tl (defstruct): New (:init ...) and (:fini ...) syntax can be used in the slot list to specify an initialization function and a gc-finalization function. * txr.1: Documented.
* Implementation of static slots for structures.Kaz Kylheku2015-09-291-9/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * share/txr/stdlib/struct.tl (sys:bad-slot-syntax): New helper function. (defstruct): Macro revamped with new slot specifier syntax for writing static slots as well as methods. * struct.c (STATIC_SLOT_BASE): New preprocessor symbol. (struct struct_type): New members, nstslots, stinitfun, stslot. (make_struct_type_compat): New static function. (struct_init): Register make-struct-type to make_struct_type_compat if compatibility is 117 or lower. Register new intrinsics static-slot, static-slot-set, call-super-method, call-super-fun, slot-p and static-slot-p. (call_stinitfun_chain): New static function. (make_struct_type): Two new arguments for specifying static slots and an initialization function for them. Logic added for setting up static slots and handling inheritance. (struct_type_destroy): New static function. (struct_type_mark): Mark the new stinitfun member of struct type. Also iterate over the static slots in the new stslot array and mark them. (lookup_slot): Altered to return a loc instead of a raw pointer, and also to accept the instance object as a member. Now resolves static slots: it can return a loc which references a static slot in the structure type, or an instance slot in the structure. (lookup_static_slot): New static function. (slot, slotset): Implementation adjusted due to new lookup_slot interface. (static_slot, static_slot_set, slot_p, static_slot_p): New functions. (call_super_method, call_super_fun): New static functions. (struct_inst_print): This function can no longer assume that the slots list lines up with the array of slots, since it contains a mixture of static and instance slots. Earnest slot lookup has to be performed. (struct_type_ops): Point the destroy function to struct_type_destroy instead of cobj_destroy_free_op. A structure type now has an array of static slots to free. * struct.h (make_struct_type): Declaration updated. (static_slot, static_slot_set, slot_p, static_slot_p): Declared. * lib.c (time_init): Update call to make_struct_type with new arguments. * sysif.c (sysif_init): Likewise. * tests/012/struct.tl: Update defstruct macro expansion test. * txr.1: Documented static slots and new functions.
* Fix two bugs in ifa macro.Kaz Kylheku2015-09-251-3/+3
| | | | | | | | | | * share/txr/stdlib/ifa.tl (ifa): Misplaced parentheses in mapcar call were causing the lists of before and after temporary variables to come up empty, resulting in a misexpansion (in the case when the it-argument is a place). Also, before and after temporaries swapped in the expansion: afters were inserted before the it-argument and vice-versa.
* Add copyright headers to some lib modules.Kaz Kylheku2015-09-254-0/+100
| | | | | | | | | | * share/txr/stlib/path-test.tl: Added header. * share/txr/stlib/struct.tl: Likewise. * share/txr/stlib/txr-case.tl: Likewise. * share/txr/stlib/with-resources.tl: Likewise.
* Version 117.txr-117Kaz Kylheku2015-09-231-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* New function path-private-to-me.Kaz Kylheku2015-09-171-0/+12
| | | | | | | | | * lisplib.c (path_test_set_entries: "path-private-to-me-p" addred to name array. * share/txr/stdlib/path-test.tl (path-private-to-me-p): New function. * txr.1: Documented path-private-to-me.