summaryrefslogtreecommitdiffstats
path: root/share
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* Version 116.txr-116Kaz Kylheku2015-09-171-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Version 115.txr-115Kaz Kylheku2015-09-101-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Bugfix: multiple evaluation problem in slot place.Kaz Kylheku2015-09-091-4/+5
| | | | | | * share/txr/stdlib/place.tl (defplace slot): The slot argument must be evaluated only once, a gensym is established for it, just like for the object form.
* Fix fun, symbol-function and symbol-value places.Kaz Kylheku2015-09-091-5/+5
| | | | | | | * share/txr/stdlib/place.tl (defplace fun, defplace symbol-function, defplace symbol-value): Fix incorrect splicing substitution of body into the output.
* Version 114.txr-114Kaz Kylheku2015-09-021-1/+1
| | | | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * genvim.txr: Scan struct.c, path-test.tl and struct.tl files. * txr.vim, tl.vim: Regenerated.
* Move stat functions to use a struct.Kaz Kylheku2015-08-301-15/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib.c (init): Move hash_init and struct init before sysif_init. * share/txr/stdlib/path-test.tl (sys:path-test-mode, path-mine-p, path-my-group-p, sys:path-access, path-newer, path-examine): Convert to struct return of stat functions. * stream.c (dev_k, ino_k, mode_k, nlink_k, uid_k, gid_k, rdev_k, size_k, blksize_k, blocks_k, atime_k, mtime_k, ctime_k): Global variable definitions removed from here. (stream_init): Initializations of moved global variables removed from here. * stream.h (dev_k, ino_k, mode_k, nlink_k, uid_k, gid_k, rdev_k, size_k, blksize_k, blocks_k, atime_k, mtime_k, ctime_k): Declarations removed from here. * sysif.c (stat_s, dev_s, ino_s, mode_s, nlink_s, uid_s, gid_s, rdev_s, size_s, blksize_s, blocks_s, atime_s, mtime_s, ctime_s): New global variables. (dev_k, ino_k, mode_k, nlink_k, uid_k, gid_k, rdev_k, size_k, blksize_k, blocks_k, atime_k, mtime_k, ctime_k): Existing variables moved here. (stat_to_struct): New static function. (stat_impl): Use stat_to_struct, except under 113 compatibility. (sysif_init): Initialize new symbol variables. Make stat struct type. * sysif.h (stat_s, dev_s, ino_s, mode_s, nlink_s, uid_s, gid_s, rdev_s, size_s, blksize_s, blocks_s, atime_s, mtime_s, ctime_s): Declared.
* Introducing structs.Kaz Kylheku2015-09-022-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * args.c (args_cat_zap): New function. * args.h: (args_cat_zap): Declared. * eval.c (struct_lit_s): New symbol variable. (eval_init): Initialize struct_lit_s. * eval.h (struct_lit_s): Declared. * gc.c (finalize): If a symbol has a struct slot hash attached to it, we must free it when the symbol is reclaimed. * lib.c (make_sym): Initialize symbol's slot_cache pointer to null. (copy): Copy structure objects. (init): Call struct_init to initialize struct module. * lib.h (SLOT_CACHE_SIZE): New preprocessor symbol (slot_cache_line_t, slot_cache_t): New typedefs. (struct sym): New member, slot_cache. * lisplib.c (struct_set_entries, struct_instantiate): New static functions. (liplib_init): Register new functions in dl_table. parser.y (HASH_S): New terminal symbol. (struct): New grammar rule. (n_expr): Derive struct. (yybadtoken): Map HASH_S to #S string. parser.l (grammar): Recognize #S and return HASH_S token. share/txr/stdlib/place.tl (slot): New defplace. share/txr/stdlib/struct.tl: New file. struct.c: New file. struct.h: New file. * Makefile (OBJS): Adding struct.o.
* Version 113.txr-113Kaz Kylheku2015-08-141-1/+1
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise.
* Version 112.txr-112Kaz Kylheku2015-08-141-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * tl.vim, txr.vim: Regenerated.
* Diagnose bad consing dot syntax like (a . b . c).Kaz Kylheku2015-08-101-1/+1
| | | | | | | | | | | | | | | | | | | | | * parser.y (r_exprs): Use unique object in the terminating cons to indicate the empty spot where the dotted cdr item will go. Check for misplaced consing dot. (misplaced_consing_dot_check): New static function. Checks for the terminator atom spot being taken already. Thus, the spot may be taken only by the very last reduction, such that the next reduction is r_exprs -> n_exprs where the terminating atom is processed. * parser.c (unique_s): New global variable. (parse_init): Initialize unique_s. * parser.h (unique_s): Declared. * share/txr/stdlib/place.tl (sys:placelet-1): We have a misplaced consing dot here! It was working correctly by "terminating atom propagation" behavior, which allowed (a . b c d) to produce (a c d . b). If a single terminating atom occurred in the middle of a list, it was promoted to the end.
* Version 111.txr-111Kaz Kylheku2015-08-081-1/+1
|
* New filesystem object testing functions.Kaz Kylheku2015-08-051-0/+98
| | | | | | | | | | * lisplib.c (path_test_set_entries, path_test_instantiate): New static functions. (dlt_register): Registered new functions to dl_table. * txr.1: Documented new functions. * share/txr/stdlib/path-test.tl: New file.
* Switching some globals to lexical and changing some names.Kaz Kylheku2015-08-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * arith.c (arith-init): Changing *flo-...* from special to lexical, and adding un-earmuffed variants. The earmuffed versions are obsolescent. Adding %pi% and %e% global lexicals. Earmuffed versions are also made global lexical, and obsolescent. * eval.c (lookup_global_var, lookup_global_var_l): New functions. (lookup_var): Uses lookup_global_var. (reg_varl): New function. (reg_var): Uses reg_var. (eval_init): Register global lexicals user-package, system-package and keyword-package. Old symbols with earmuffs are obsoleted, and also turned into global lexicals. (top-vb, top-fb): Changed to lexical. * eval.h (lookup_global_var, lookup_global_var_l, reg_varl): Declared. * genvim.txr: Scan ver.tl so that the lib-version variable is included. Extract reg_varl calls. * glob.c (glob_init): glob-err and other variables made lexical. * lib.c (get_user_package, get_system_package, get_keyword_package): Use lookup_global_var_l to avoid searching dynamic scope for lexicals which cannot be dynamically rebound. * share/txr/stdlib/ver.tl (lib-version): New global lexical variable. (*lib-version*): Turned lexical. Obsolescent. * signal.c (sig-init): sig-* variables turned lexical. * sysif.c (sysif-init): s-*, poll-* and w-* variables turned lexical. * syslog.c (syslog-init): log-* variables turned lexical. * txr.c (sysroot-init): stdlib and *txr-version* variables turned lexical. txr-version variable added, and *txr-version* is obsolescent. (txr-main): self-path variable added. *self-path* turns lexical and is obsolescent. * txr.1: Documentation updated. Lexical variables not referred to as special. Special variables referred to as special.