summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Slight internal representation change of string-only exceptions.Kaz Kylheku2015-02-065-17/+46
| | | | | | | | | | | | | | | | | | | | | | | | | One upshot of all this is that (throw 'foo "msg") now does exactly the same thing as (throwf 'foo "msg"). A message-only exception really is a one-string exception argument list ("message ..."), like the documentation says. * unwind.h (struct uw_catch): exception member renamed to args. (uw_catch): Macro follows structure member rename. * eval.c (op_catch): Removed now unnecessary kludge of turning non-list exception argument list into a one-element argument list. * match.c (v_try): Similar hack to the one in op_catch removed here. * unwind.c (uw_unwind_to_exit_point, uw_push_catch): Follows rename of exception member. (uw_throw): The exception parameter is renamed to args. The kludge removed from op_catch re-appears here, because numerous calls to uw_throw just pass a string as args. It's less of a kludge here because this is the master entry point to exception processing, and it straightens out the representation right away. The exception arguments or message are printed in a clearer way.
* Serious bugfix in the op macro, and derived macro, inKaz Kylheku2015-02-062-3/+13
| | | | | | | | | | | the handling of missing meta-numbers (for instance (op ... @1 .. @3): 1 and 3 occur, but not 2. * eval.c (supplement_op_syms): Bugfix: loop was testing and updating the wrong variable, causing it to be looking at the first element of the syms list in every iteration. Not a regression: this was implemented wrong when the function was introduced on October 6, 2013.
* * eval.c (subst_vars): Bugfix. When an ordinary variableKaz Kylheku2015-02-062-12/+14
| | | | | | | | | | | occurs in the quasi syntax (which is the result of substitution of metanums like @1 by the op macro), if that variable evaluated to a list form, it was not being converted to a string. The resulting form was then examined for variable substitutions as if it were part of the quasi syntax. This was introduced at the same time as the feature of being able to use metanums in a quasiliteral (Feb 13, 2012: last change before Version 57).
* * eval.c (transform_op): When expanding @rest and metanumsKaz Kylheku2015-02-062-2/+14
| | | | | | | like @1, @2, preserve the (sys:var X args ..) structure if there are args (but of course with X replaced by the appropriate gensym). This allows syntax like `@{1 10}` to work in quasiliterals: in other words, modifiers on interpolated metas, on par with @{a 10}.
* * sysif.c (abort_wrap): New static function.Kaz Kylheku2015-02-065-328/+370
| | | | | | | | | | (sysif_init): Registered abort intrinsic. * txr.1: Documented abort. Changed Unix Programming heading to System Programming, since exit, abort and errno are not Unix-specific, but C-specific. * tl.vim, txr.vim: Updated.
* * unwind.c (unhandled_hook_s): New static variable.Kaz Kylheku2015-02-068-333/+424
| | | | | | | | | | | | | | | | | | | (uw_throw): In the unhandled case, check if *unhandled-hook* variable has a function, and use it instead of the default logic. If it's not a function, abort with an error message. Clear it so that if the hook function re-enters this code, it will not be used. Always exit now on unhandled exceptions; do not abort. (uw_late_init): New function. * unwind.h (uw_late_init): Declared. * lib.c (init): Call uw_late_init. * txr.1: Documented *unhandled-hook*. * genvim.txr: Scan the unwind.c file, since it has a reg_var now. * tl.vim, txr.vim: Updated.
* * win/env.nsh: Before the potentially length SendMessage,Kaz Kylheku2015-02-052-1/+8
| | | | print an informative message.
* * win/env.nsh: Improve messages about environmentKaz Kylheku2015-02-052-9/+14
| | | | variable modification.
* Symbol macros shadowed by functions under dwim.Kaz Kylheku2015-02-033-20/+125
| | | | | | | | | | | * eval.c (lookup_symac_lisp1, expand_lisp1, expand_forms_lisp1): New static functions. (expand): Handle dwim's arguments via expand_forms_lisp1, rather than as a generic compound form. * txr.1: Revised text in several places to clarify this expansion rule.
* Version 103.txr-103Kaz Kylheku2015-02-015-4/+62
|
* Update copyright notices from 2014 to 2015.Kaz Kylheku2015-02-0140-40/+53
| | | | | | | | | | | * arith.c, arith.h, combi.c, combi.h, debug.c, debug.h, eval.c, eval.h, filter.c, filter.h, gc.c, gc.h, hash.c, hash.h, lib.c, lib.h, match.c, match.h, parser.h, rand.c, rand.h, regex.c, regex.h, signal.c, signal.h, stream.c, stream.h, sysif.c, sysif.h, syslog.c, syslog.h, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h: Update. * LICENSE, METALICENSE: Likewise.
* Windows installer.Kaz Kylheku2015-02-013-0/+442
| | | | | | * inst.nsi: New file. * win/env.nsh: New file.
* On Windows, add icon and identifying meta-data to executable.Kaz Kylheku2015-01-316-3/+75
| | | | | | | | | | | | | | | * Makefile (EXTRA_OBJS-y): New variable. (WINDRES): New recipe. * configure: Check for presence of windres, and generate add_win_res variable in config.make. * win/txr.xcf: New file: GIMP project for icon. * win/txr.ico: New file: icon with three sizes generated from GIMP project. * win/txr.rc: New file.
* Use macro to initialize strm_ops.Kaz Kylheku2015-01-294-222/+170
| | | | | | | | | | * stream.h (strm_ops_init): New macro. * stream.c (null_ops, stdio_ops, tail_ops, pipe_ops, string_in_ops, byte_in_ops, string_out_ops, strlist_out_ops, dir_ops, cat_stream_ops): Initialize using macro. * syslog.c (syslog_strm_ops): Likewise.
* Use macro to initialize cobj_ops.Kaz Kylheku2015-01-295-35/+40
| | | | | | | | | | * lib.h (cobj_ops_init): New macro. * hash.c (hash_ops, hash_iter_ops): Initialize with cobj_ops_init. * rand.c (random_state_ops): Likewise. * regex.c (char_set_obj_ops, regex_obj_ops): Likewise.
* * arith.c (make_ubignum): New static function.Kaz Kylheku2015-01-297-258/+338
| | | | | | | | | | | | (sign_extend): New function. * eval.c (eval_init): Register sign-extend intrinsic. * lib.h (sign_extend): Declared. * txr.1: Documented sign-extend. * tl.vim, txr.vim: Updated.
* * txr.1: Minor change under make-random-state.Kaz Kylheku2015-01-291-1/+1
|
* * txr.1: fixed use of nonexistent str-int in @(require) example;Kaz Kylheku2015-01-292-5/+8
| | | | fixed bad formatting under logtrunc and partition.
* * eval.c (get_opt_param_syms): Fix broken function. ThisKaz Kylheku2015-01-282-9/+15
| | | | | | was choking on keywords like :env in the lambda list, and failing to handle the nested patterns of macro lambda lists. Failing case: (defmacro x (: opt :env foo)).
* * eval.c (bind_macro_params): Bugfix: the colon argument's specialKaz Kylheku2015-01-282-1/+7
| | | | | meaning "treat the argument as missing" must apply only to optional parameters.
* * lib.c (make_like): Fix regression introduced in 102.Kaz Kylheku2015-01-272-1/+7
| | | | | A one element list being converted to a string treated as an empty list, leading to empty string.
* * arith.c (width): New function.Kaz Kylheku2015-01-275-0/+80
| | | | | | | | * arith.h (width): Declared. * eval.c (eval_init): Width registered as intrisinc. * txr.1: Documented width.
* * eval.c (call_f): new global variable.Kaz Kylheku2015-01-253-2/+74
| | | | | | | | | (do_mapf, mapf): new static functions. (eval_init): protect call_f from gc, and initialize it. re-register call function using call_f. register mapf intrinsic. * txr.1: Documented mapf.
* * eval.c (eval_init): Register dupl and swap_12_21 asKaz Kylheku2015-01-255-0/+56
| | | | | | | | | | | the dup and flip intrinsics. * lib.c (do_dup): New static function. (dupl): New function. * lib.h (dupl): Declared. * txr.1: Documented dup and flip.
* * eval.c (callf): New static function.Kaz Kylheku2015-01-243-0/+47
| | | | | | (eval_init): callf registered. * txr.1: Documented callf.
* * txr.1: Grammar.Kaz Kylheku2015-01-241-1/+1
|
* Basic implementation of constantp. Does notKaz Kylheku2015-01-215-284/+370
| | | | | | | | | | | recognize forms like (+ 2 2) as constant. * eval.c (constantp_noex, constantp): New functions. (eval_init): Registered constantp as intrinsic. * tl.vim, txr.vim: Updated. * txr.1: Documented constantp.
* * stream.c (get_string): New argument, close_after_p.Kaz Kylheku2015-01-214-4/+33
| | | | | | | | | | | Close the stream unless close_after_p is specified and is nil, or when it is missing, an there is no compatibility or it's newer than version 102. * stream.h (get_string): Updated declartion. * txr.1: Documented default closing behavior of get-string and the new optional argument for overriding it.
* * txr.1: Minor fix in split-str-set documentation.Kaz Kylheku2015-01-212-1/+5
|
* Allow macros to tell what symbols have lexical functionKaz Kylheku2015-01-215-192/+305
| | | | | | | | | | | or variable bindings. * eval.c (lexical_var_p, lexical_fun_p): New local functions. (eval_init): Registered as intrinsics. * txr.1: Documented lexical-var-p and lexical-fun-p. * tl.vim, txr.vim: Updated.
* Version 102.txr-102Kaz Kylheku2015-01-137-230/+285
|
* * arith.c (zerop): Handle character arguments.Kaz Kylheku2015-01-125-1/+76
| | | | | | | | | | | (plusp, minusp): New functions. * eval.c (eval_init): Register plusp and minusp. * lib.h (plusp, minusp): Declared. * txr.1: Documented plusp and minusp, and the handling of characters by zerop.
* Fix for LLVM wchar_t literals not being four byteKaz Kylheku2015-01-124-46/+60
| | | | | | | | | | | | | | | | | aligned, affecting OS X port. * configure: Detect a SIZEOF_WCHAR_T when detecting integer type that will hold a pointer. In the lit_align test, if we are on Apple Mac OSX, use a lit_align of 2, so the logic kicks in for padding literals and handling misalignment. * lib.h (litptr): Add a case for LIT_ALIGN < 4 and SIZEOF_WCHAR_T == 4. In this case we do the arithmetic on the pointer using short *, and then convert to wchar_t. * HACKING: New section 2.4.3 about new wchar_t hack.
* * signal.h (sig_save_enable, sig_save_disable):Kaz Kylheku2015-01-122-8/+15
| | | | | | | | Use do;while(0) trick instead of local typedef to cause terminating semicolon to be required. (sig_restore_enable, sig_restore_disable): Remove superfluous do { } while (0). Closing a brace is good enough.
* * glob.c: New file.Kaz Kylheku2015-01-118-1/+272
| | | | | | | | | | | | | | | | | | | | (glob_wrap, glob_init): New functions. (errfunc_thunk): New static function. * glob.h: New file. * txr.c (main): call glob_init if HAVE_GLOB is defined. * configure (have_glob): New variable. (gen_config_make): Add have_glob to config/config.make. Detect glob function and set have_glob, and add HAVE_GLOB to config/config.h. * Makefile (OBJS): Include glob.h if have_glob is "y". * genvim.txr: Scan glob.c for functions and variables also. * txr.1: Documented glob and glob-related variables.
* * Makefile (retest): New phony target for convenience.Kaz Kylheku2015-01-112-0/+7
|
* * lib.c (make_like): Bugfix. (make-like nil "abc")Kaz Kylheku2015-01-113-0/+27
| | | | | | | | | | must return the empty string, not nil. Only lists of non-characters fail to convert to a string. Since programs may depend on the hitherto wrong, undocumented behavior, this is made subject to compatibility. * txr.1: Added compatibility note.
* * eval.c (merge_wrap): Make generic over sequences.Kaz Kylheku2015-01-113-15/+35
| | | | * txr.1: Update documentation for merge function.
* * match.c (h_trailer): Bugfix: not returning new variableKaz Kylheku2015-01-052-2/+7
| | | | bindings captured in trailer section. Ouch!
* * txr.1: Formatting fixes.Kaz Kylheku2015-01-031-2/+2
|
* Version 101.txr-101Kaz Kylheku2015-01-014-5/+96
|
* * Makefile (rebuild, clean, repatch): Fail these targets ifKaz Kylheku2015-01-012-4/+30
| | | | | | the program is not configured. (distclean): Providing alternative implementation when the program is not configured.
* * lib.c (replace_str, replace_vec): Bugfix. The replacement itemKaz Kylheku2014-12-312-87/+98
| | | | | | sequence may be an infinite list in the case that the from argument specifies a list of indices. We must avoid trying to calculate its length before we have detected this case.
* * txr.1: Fix error. (set [seq index-list] new) corresponds toKaz Kylheku2014-12-312-3/+13
| | | | replace not to refset.
* * lib.c (simple_lazy_stream_func): Bugfix: close the streamKaz Kylheku2014-12-254-10/+28
| | | | | | | | | | if get_line returns nil. * stream.c (cat_get_line, cat_get_char, cat_get_byte): The catenated stream read operations close an exhausted stream before popping to the next one. * txr.1: Document closing behavior of catenated streams.
* * stream.c (stream_init): Register make_catenated_stream inKaz Kylheku2014-12-255-297/+313
| | | | | | | | a different form as cat-streams. * txr.1: Document cat-streams. * tl.vim, txr.vim: Regenerated.
* * txr.1: Small fix under get-lines.Kaz Kylheku2014-12-251-1/+1
|
* * eval.c (ap_s, ret_s, aret_s): New symbol variables.Kaz Kylheku2014-12-235-311/+372
| | | | | | | | | | | | (me_ret): Static function renamed to me_ret_aret. Handles ret and aret macro expansion. (eval_init): Initialize ap_s, ret_s and aret_s. Re-register ret macro using ret_s and bind to me_ret_aret. Register aret macro. * txr.1: Documented aret. * tl.vim, txr.vim: Regenerated.
* * eval.c (eval_init): Registered intrinsic function unique.Kaz Kylheku2014-12-237-18/+109
| | | | | | | | | | | * lib.c (unique): New function. (uniq): Becomes wrapper around unique. * lib.h (unique): Declared. * txr.1: Documented unique, and equivalence between uniq and unique. * tl.vim, txr.vim: Regenerated.
* * lib.c (func_n1ov, func_n2ov, func_n3ov): New functions.Kaz Kylheku2014-12-233-0/+30
| | | | * lib.h (func_n1ov, func_n2ov, func_n3ov): Declared.