summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Deal with spurious retention in function application.Kaz Kylheku2015-03-314-114/+135
| | | | | | | | | | | | * gc.h (zap): New inline function. (z): New macro. * lib.c (generic_funcall, funcall1, funcall2, funcall4, do_not, do_dup, do_iff): Use z macro to burn funargs with no next use. * eval.c (apply, apply_frob_args, iapply, call, do_eval, op_dwim, mapcarv, mappendv, lazy_mapcarv_func, mapdov, do_apf, do_ipf, callf): Use z macro to burn funargs with no next use.
* * stream.c (vformat): Bugfix: ~X printing in lower case, like ~x,Kaz Kylheku2015-03-302-1/+6
| | | | when argument is a bignum integer.
* * mpi-patches/eliminate-locale-dependencies: New patch.Kaz Kylheku2015-03-293-0/+53
| | | | | | (s_mp_tovalue): Eliminate use of isupper, islower. * mpi-patches/series: Add patch.
* New -n option. New "i" mode letter in file opening functions.Kaz Kylheku2015-03-295-31/+242
| | | | | | | | | | | | | | | | | | | | | | | | * stream.c (struct stdio_mode): New struct type. (stdio_mode_init_trivial): New initializer macro. (parse_mode, format_mode, normalize_mode, set_mode_props): New static functions. (make_stdio_stream_common): the isatty check, and automatic marking of tty device streams as real-time is no longer done, unless backward compatibility 105 or earlier is requested. (open_file, open_tail, open_command, open_process): Use new mode parsing, which supports the "i" flag. (stream_init): If we have isatty, and standard input is a tty, then mark the *std-input* stream as real-time. * txr.1: Document -n/--noninteractive option. Fix typo where real-time-stream-p is referred to as stream-real-time-p. Document "i" flag on open-file and others. * txr.c (opt_noninteractive): New global. (help): Help text for -n/--noninteractive. (txr_main): Handle new options. * txr.h (opt_noninteractive): Declared.
* * eval.c (prinl, pprinl): Become external functions.Kaz Kylheku2015-03-285-5/+90
| | | | | | | | | | | (tprint): New function. (eval_init): Register tprint as intrinsic. * eval.h (prinl, pprinl, tprint): Declared. * txr.c (txr_main): New option, -t. * txr.1: Documented tprint and -t option.
* * eval.c (eval_init): register get-lines as having one optionalKaz Kylheku2015-03-284-3/+20
| | | | | | | | argument. * lib.c (lazy_stream_cons): Default the argument to std_input. * txr.1: Document that the stream is optional in get-lines.
* * txr.1: formatting fixes in weave description.Kaz Kylheku2015-03-241-1/+2
|
* * Makefile (enforce): Update error error message.Kaz Kylheku2015-03-243-8/+20
| | | | | | * configure (have_git): Don't set this variable if the TXR repository is missing, even if git is installed. I.e. have_git means have have the tool and the repo.
* * lib.c (int_str): Workaround for wcstol recognizing the 0x prefix whenKaz Kylheku2015-03-203-1/+36
| | | | | | | radix is 16. Also, thrown an error if radix is not in the range 0 to 36. * txr.1: Document int-str's radix range restriction.
* * txr.c (help): Added missing documentation for -e and -p.Kaz Kylheku2015-03-173-11/+42
| | | | | | | Also documented -P. (txr_main): New option implemented, -P. * txr.1: Document -P, and clean up -e and -p documentation.
* Version 105.txr-105Kaz Kylheku2015-03-147-280/+335
|
* * stream.c (run): In Windows version, fix nasty corruption bug:Kaz Kylheku2015-03-112-2/+6
| | | | | we were freeing C strings that were not duplicated, but only borrowed from string objects.
* * stream.c (open_process, run, sh): Eliminate utf8name local variableKaz Kylheku2015-03-112-10/+12
| | | | | and associated memory leak. Correctly allocate only nargs + 1 elements for argv array, not nargs + 2.
* * sysif.c (mkdir_nothrow_exists): New static function.Kaz Kylheku2015-03-103-1/+81
| | | | | | | (ensure_dir): New function. (sysif_init): ensure_dir registered as intrinsic. * txr.1: ensure_dir documented.
* * parser.c (open_txr_file, regex_parse, lisp_parse): FunctionsKaz Kylheku2014-12-213-77/+85
| | | | | | | moved here from parser.l. * parser.l (open_txr_file, regex_parse, lisp_parse): Functions moved from here to parser.c.
* * Makefile (OBJS): Add parser.o.Kaz Kylheku2014-12-215-3/+107
| | | | | | | | | | * parser.h (parser_s): Declared. (parse_init): Declaration removed. (parser_l_init): Declared. * parser.l (parse_init): Function renamed to parser_l_init. * parser.c: New file.
* New ignerr macro.Kaz Kylheku2015-02-255-218/+269
| | | | | | | | | * eval.c (me_ignerr): New static function. (eval_init): Registered ignerr macro. * txr.1: Documented. * tl.vim, txr.vim: Regenerated.
* Introducing persistent error state on streams.Kaz Kylheku2015-02-257-30/+337
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib.c (cobj_ops): New function. * lib.h (cobj_ops): Declared. * stream.c (null_ops): Initializer updated. (struct stdio_handle): New member, err. (stdio_stream_mark): Mark the err member. (errno_to_string): New static function. (stdio_maybe_read_error, stdio_maybe_error): Set persistent error state. Use errno_to_string_function. (stdio_put_string, stdio_put_char, stdio_put_byte, stdio_seek, stdio_get_line): Set errno to zero, so that if the underlying operations do not set errno on err, we don't misinterpret some pervious errno value as pertaining to the failed stream operation. (stdio_get_error, stdio_get_error_str, stdio_clear_error): New static functions. (stdio_ops, tail_ops, pipe_ops): Update initializer with new functions. (string_in_get_error, string_in_get_error_str): New static functions. (string_in_ops): Update initializer with new functions. (byte_in_get_error, byte_in_get_error_str): New static functions. (byte_in_ops): Update initializer with new functions. (string_out_ops, strlist_out_ops): Update initializer with null pointers for new functions. (struct dir_handle): New struct type. (dir_destroy, dir_mark): New functions. (dir_get_line): Refactor for struct dir_handle context rather than DIR. Persist error state. (dir_close): Refactor for struct dir_handle. (dir_get_error, dir_get_error_str, dir_clear_error): New static functions. (dir_ops): Update initializer with new functions. (make_stdio_stream_common): Initialize new err member. (make_dir_stream): Refactor for struct dir_handle. (get_error, get_error_str, clear_error): New functions. (cat_get_error, cat_get_error_str, cat_clear_error): New static functions. (cat_stream_ops): Update initializer with new functions. (stream_init): Register get-error, get-error-str, clear-error intrinsics. * stream.h (struct strm_ops): New function pointer members, get_error, get_error_str and clear_error. (strm_ops_init): Macro extended with new arguments for new function pointers. (get_error, get_error_str, clear_error): Declared. * syslog.c (syslog_strm_ops): Update initializer with null pointers for new functions. * txr.1: Documented get-error, get-error-str and clear-error.
* Improved error reporting, particularly for macro expansion.Kaz Kylheku2015-02-215-10/+58
| | | | | | | | | | | | | | | | | | | * eval.c (last_form_expanded): New variable. (do_expand): New static function; contains previous expand function. (expand): Becomes a wrapper for do_expand, with re-entry counting. (eval_init): GC-protect last_form_expanded. * eval.h (last_form_expanded): Declared. * parser.l (regex_parse, lisp_parse): Just use a simple word for the name of the regex or string parse location, not the entire expression itself. * unwind.c (uw_throw): Check whether expansion was going on when the unhandled exception was thrown and print additional information.
* * regex.c (match_regex_right): Bugfix: zero length matchesKaz Kylheku2015-02-202-1/+7
| | | | | should return zero length, rather than nil. This is achieved by trying the match at one past the last character.
* String-returning wrappers for some regex matching functions.Kaz Kylheku2015-02-205-4/+74
| | | | | | | | | | | * eval.c (eval_init): Register search-regst, match-regst and match-regst-right intrinsics. * regex.c (search_regst, match_regst, match_regst_right): New functions. * regex.h (search_regst, match_regst, match_regst_right): Declared. * txr.1: Documented new variants.
* * regex.c (print_rec): A compound must use parentheses forKaz Kylheku2015-02-152-2/+13
| | | | elements which have a higher precedence than catenation.
* * lib.c (list_collect, list_collect_append): In errorKaz Kylheku2015-02-122-2/+9
| | | | | | messages about bad appends, do not show the list being appended because it may be an infinite lazy list. For instance (append* 3 lazy-list).
* New functions pad and weave.Kaz Kylheku2015-02-123-0/+152
| | | | | | | | * eval.c (pad_func, pad, weave_while, weave_gen, weavev): New static functions. (eval_init): Registered pad and weave intrisics. * txr.1: Documented pad and weave.
* * lib.c (lazy_appendv_func, lazy_appendv): Bugfix: append*Kaz Kylheku2015-02-122-2/+20
| | | | | | | | | was silently ignoring lists after the first atom, instead of throwing an error. Also, it was not detecting the case that the last argument is a list which should just be returned, and instead trying to find its tail in preparation for the next call to lazy_appendv_func, the consequences being runaway iteration over an infinite list.
* * eval.c (symacro_k, fun_k): New keyword variables.Kaz Kylheku2015-02-104-2/+78
| | | | | | | | | | (lexical_lisp1_binding): New static function. (eval_init): Initialize symacro_k and fun_k; register new intrinsic function lexical-lisp1-binding. * match.h (var_k): Existing external name declared. * txr.1: Documented lexical-lisp1-binding.
* * Makefile: Add dependency froml $(EXTRA_OBJS-y) to headerKaz Kylheku2015-02-092-1/+9
| | | | | file and config.h, so windows resource file is rebuilt when the version changes.
* * Makefile: Removing bogus eval which refers to nonexistentKaz Kylheku2015-02-092-4/+5
| | | | DEP_INSTANTIATE macro.
* * Makefile (clean): Remove $(EXTRA_OBJS-y) so the Windows .resKaz Kylheku2015-02-092-1/+6
| | | | file is removed.
* Version 104.txr-104Kaz Kylheku2015-02-085-4/+69
|
* * arith.c (trunc_rem): New function.Kaz Kylheku2015-02-077-21/+62
| | | | | | | | | | * eval.c (eval_init): Register trunc-rem intrinsic. * lib.h (trunc_rem): Declared. * txr.1: Documented trunc-rem. * tl.vim, txr.vim: Updated.
* * Makefile (CFLAGS): Removed puzzling, unnecessary definitionsKaz Kylheku2015-02-0716-91/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of XMALLOC, XCALLOC, XREALLOC and XFREE for $(MPI_OBJS). MPI does not use such macros and the allocator is already retargetted to use the TXR one. * mpi-patches/use-txr-allocator: In this patch, we don't need external declaration for chk_malloc or chk_realloc because they are not used. Only chk_calloc is used. * mpi-patches/add-bitops: Refreshed. * mpi-patches/add-mp-hash: Likewise. * mpi-patches/add-mp-set-intptr: Likewise. * mpi-patches/add-mpi-toradix-with-case: Likewise. * mpi-patches/bit-search-optimizations: Likewise. * mpi-patches/export-mp-eq: Likewise. * mpi-patches/faster-square-root: Likewise. * mpi-patches/fix-bad-shifts: Likewise. * mpi-patches/fix-ctype-warnings: Likewise. * mpi-patches/fix-mult-bug: Likewise. * mpi-patches/mpi-set-double-intptr: Likewise. * mpi-patches/mpi-set-mpi-word: Likewise. * mpi-patches/mpi-to-double: Likewise.
* Support txr-win.exe target which has no console window.Kaz Kylheku2015-02-073-5/+37
| | | | | | | | | | * Makefile (EACH_CONF): Iterate over arguments. (opt/txr-win.o, dbg/txr-win.o): New special object files. (opt/%-win.o, dbg/%-win.o): New pattern rule to build special object files. ($(PROG)-win, $(PROG)-win-dbg): New program targets. * inst.nsi: Install txr-win.exe.
* * txr.1: fixed flurry of phrasing, formatting fumbles.Kaz Kylheku2015-02-072-12/+26
|
* * tests/011/macros-1.txr: Add test for lexical functionKaz Kylheku2015-02-073-0/+14
| | | | | | shadowing symbol macro. * tests/011/macros-1.expected: Updated.
* * unwind.c (uw_throw): Detect invalid re-entry and bail.Kaz Kylheku2015-02-062-0/+13
| | | | | Cautiously, we use fprintf rather than our streams system, in case some problem with the streams is involved in this mess.
* * unwind.c (uw_throw): Put a txr: prefix on the unhandledKaz Kylheku2015-02-062-1/+6
| | | | exception in early initialization message.
* 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.