summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Diagnose trailing junk in numeric literals.Kaz Kylheku2015-04-142-14/+28
| | | | | | | * parser.l: Combining the handling of hex, octal and binary numeric literals into a single rule. Implementing an additional rule which diagnoses such tokens that have trailing junk. Thus, something like #x1F2AZ is now invalid syntax.
* Implementing while* and until* loops.Kaz Kylheku2015-04-115-21/+90
| | | | | | | | | | | * eval.c (while_star_s, until_star_s): New symbol variables. (me_while_star, me_until_star): New static functions. (eval_init): Initialize new variables. Register while* and until* macros. * txr.1: Documented while* and until*. * txr.vim, tl.vim: Regenerated.
* * txr.1: Add powerset example under comb functionKaz Kylheku2015-04-111-0/+10
|
* * sysif.c: Use HAVE_FORK_STUFF to wrap fork, waitpid and dup/dup2.Kaz Kylheku2015-04-112-2/+6
|
* Exposing dup and dup2.Kaz Kylheku2015-04-115-288/+323
| | | | | | | | | | * sysif.c (dup_wrap): New static function. (sysif_init): Register dup_wrap as dupfd. The name dup conflicts with an existing function. * txr.1: Documented dupfd. * txr.vim, tl.vim: Regenerated.
* Functions open-fileno and fileno.Kaz Kylheku2015-04-106-1/+84
| | | | | | | | | | | | | | | | * stream.c (fd_k): New keyword variable. (stdio_get_prop): Handle the :fd property by returning the file descriptor. (open_fileno): New function. (stream_init): Initialize fd_k, and register fileno and open-fileno. * stream.h (open_fileno): Declared. * txr.1: Documented open-fileno and fileno. * utf8.c (w_fdopen): New function. * utf8.h (w_fdopen): Declared.
* * gc.c (sweep): Fix comment referring to nonexistent identifier.Kaz Kylheku2015-04-102-1/+5
|
* * eval.c (eval_init): There is an until_s global variable, soKaz Kylheku2015-04-102-1/+6
| | | | no need to intern the symbol when registering me_until.
* * txr.1: Flurry of formatting fixes.Kaz Kylheku2015-04-091-6/+6
|
* Fork and wait support.Kaz Kylheku2015-04-095-258/+510
| | | | | | | | | | | | | | * sysif.c (work_wrap, wait_wrap, wifexited, wexitstatus, wifsignaled, wtermsig, wcoredump, wifstopped, wstopsig, wifcontinued): New static functions. (sysif_init): Register new intrinsics: functions fork, wait, w-ifexited, w-exitstatus, w-ifsignaled, w-termsig, w-coredump, w-ifstopped, w-stopsig, w-ifcontinued; and variables w-nohang, w-untraced, w-continued. * txr.1: Documented. * tl.vim, txr.vim: Regenerated.
* * eval.c (iflet_s, when_s): New global variables.Kaz Kylheku2015-04-065-224/+335
| | | | | | | | | | | (me_iflet_whenlet): New static function. (eval_init): Initialize when_s, iflet_s. Use when_s for registering me_when. Register me_iflet_whenlet. * txr.1: Documented iflet and whenlet. * tl.vim, txr.vim: Regenerated.
* Move documentation of macros from between cond and if.Kaz Kylheku2015-04-061-139/+138
| | | | | | * txr.1: move the documentation of some control and iterative macros from between if and cond to after the control constructs.
* * txr.1: formatting fix in pos-min/pos-max.Kaz Kylheku2015-04-061-2/+2
|
* New whilet macro.Kaz Kylheku2015-04-055-28/+125
| | | | | | | | | | | * eval.c (while_s): New symbol variable. (me_whilet): New static function. (eval_init): Initialize while_s. Use while_s in registration of while macro. Register new whilet macro. * txr.1: whilet is documented. * tl.vim, txr.vim: Regenerated.
* * txr.1: Formatting issue in for/for* syntax.Kaz Kylheku2015-04-041-4/+4
|
* New zap operator.Kaz Kylheku2015-04-013-2/+40
| | | | | | | | * eval.c (zap_s): New global variable. (op_modplace): Support zap. (eval_init): Initialize zap_s, and register as operator. * txr.1: Documented zap.
* Array overrun fix in apply.Kaz Kylheku2015-03-312-12/+22
| | | | | | | | | * eval.c (APPLY_ARGS): New preprocessor symbol, replaces hard-coded 32 inside apply. (apply): Use APPLY_ARGS for argument array. Fix overrun of args array in non-variadic function case when list has more than APPLY_ARGS elements. Eliminate superflous "variadic" local variable.
* 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.