| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
| |
The dwim operator is deleted when the symbol is do.
(expand): Expand do_s form with expand_op, not only op_s. Pass down
symbol.
* txr.1: Document do operator.
|
|
|
|
|
| |
rearrangement that gives precedence to operator lookup over function
lookup.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (expand_forms): Static function becomes external.
(expand_form): Remove case which handles do_s.
* eval.h (expand_forms): Declared.
* parser.y (elem): Expand both do_s and require_s forms by
using expand_forms.
|
|
|
|
|
|
|
|
|
|
|
| |
(lazy_conses_func): New static function.
* lib.h (conses, lazy_conses, func_set_env): Declared.
* eval.c (eval_init): conses, lazy_conses and func_set_env registered
as intrinsics.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the extension of list operations over vectors and strings.
* eval.c (do_eval_args, bindings_helper, op_each,
subst_vars, supplement_op_syms, mapcarv, mappendv): Switch from
list_collect_* macros to functions.
* lib.c (copy_list): Switch from list_collect* macros to functions.
Use list_collect_nconc for the final terminator. Doing a copy
there with list_collect_append was actually wasteful, and now
that list_collect_append calls copy_list in places, it triggered
runaway recursion.
(make_like): Bugfix: list_vector was used instead of vector_list.
(to_seq, list_collect, list_collect_nconc, list_collect_append): New
functions.
(append2, appendv, nappend2, sub_list, replace_list, ldiff, remq,
remql, remqual, remove_if, keep_if, proper_plist_to_alist,
improper_plist_to_alist, split_str, split_str_set, tok_str,
list_str, chain, andf, orf, lis_vector, mapcar, mapcon, mappend,
merge, set_diff, env): Switch from list_collect* macros to functions.
(replace_str, replace_vec): Allow single item replacement sequence.
* lib.h (to_seq): Declared.
(list_collect, list_collect_nconc, list_collect_append): Macros
removed, replaced by function declarations of the same name.
These functions return the new ptail since they cannot assign
to it, requiring all uses to be updated to do the assignment
of the returned value.
(list_collect_decl): Use val rather than obj_t *.
* match.c (vars_to_bindings, h_coll, subst_vars, extract_vars,
extract_bindings, do_output_line, do_output, v_gather, v_collect):
Switch from list_collect* macros to functions.
* parser.y (o_elems_transform): Likewise.
* regex.c (dv_compile_regex, regsub): Likewise.
* txr.c (txr_main): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
evaluation like (op or @1 42) or (op if (eq @1 foo) bar xyzzy)
is possible.
* eval.c (do_eval): Change precedence between operator and
function lookup to favor operators. This is important since
there are several operators now which are also functions.
(if_fun, or_fun, and_fun): New static functions.
(eval_init): New functions registered as intrinsics.
* txr.1: Documented that if, and, or exist as both functions
and operators.
|
|
|
|
|
|
|
|
|
| |
* eval.h (eval_intrinsic): Declared.
* txr.c (spec_file): Global variable removed.
(txr_main): Support for -e and -p options. Minor code cleanup.
* txr.1: Documented new options.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
input sequence.
* lib.c (make_like): New function.
(reverse, remq, remql, remqual, remove_if, keep_if, mapcar, mapcon,
mappend, set_diff): Convert output list to type of leftmost input
sequence.
* lib.h (make_like): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
Thereby, numerous previously list-only operations in TXR Lisp
now magically handle strings and vectors.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
| |
(time_fields_local, time_fields_utc): New functions.
* lib.h (time_fields_local, time_fields_utc): Declared.
* eval.c (eval_init): Intern time_fields_local and time_fields_utc
as intrinsic functions.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* hash.h (group_by): Declared.
* eval.c (eval_init): group_by registered as group-by intrinsic.
* txr.1: Documented.
|
| |
|
|
|
|
|
| |
of @sym and @(expr ...) syntax back to these notations instead
of leaving them as (sys:var sym) and (sys:expr expr ...).
|
|
|
|
|
|
|
|
|
|
| |
of C names of functions, or otherwise clarified them.
* filter.c: Likewise.
* lib.c: Likewise.
* match.c: Likewise.
|
|
|
|
|
|
|
|
| |
(op_each, expand): Support append-each and append-each*.
(eval_init): Initialize new symbol variables, and register
new operators.
* txr.1: Document append-each and append-each*.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register as atang2 as a atan2 intrinsic.
* lib.h (atang2): Declared.
* txr.1: Documented atan2.
|
| |
|
| |
|
|
|
|
| |
that may have been put back with unget_char.
|
|
|
|
|
|
|
| |
arguments.
(op_defun): Permit the syntax.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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): Structure definition updated
with new initializers for two new virtuals.
(stdio_handle): New member, unget_c.
(snarf_line, stdio_get_char): Handle pushed-back character in
h->unget_c.
(stdio_unget_char, stdio_unget_byte, string_in_unget_char,
byte_in_unget_byte): New static functions.
(make_stdio_stream_common): Initialize unget_c member.
(unget_char, unget_byte): New functions.
* stream.h (struct strm_ops): New virtuals: unget_char and unget_byte.
(unget_char, unget_byte): New functions declared.
* syslog.c (syslog_strm_ops): Two new initializers.
* eval.c (eval_init): Registered unget_char and unget_byte as
intrinsics.
* txr.1: Documented.
|
|
|
|
| |
virtual function is not null, rather than put_byte.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
corresponds to the high bit of a bitmap cell: for instance
the character \x7f when the cell size is 32 bits.
* regex.c (BITCELL_ALL1): Unused macro removed.
(BITCELL_BIT): New macro to replace occurrences of a repeated
expression.
(CHAR_SET_INDEX, CHAR_SET_BIT): Updated to use BITCELL_BIT.
(L0_fill_range): Bugfix: the mask1 calculation was producing all-zero
in the condition bt1 == BITCELL_BIT; it should produce an all-ones
mask.
|
|
|
|
|
|
|
|
|
|
| |
* txr.c (version): Bumped.
* txr.1: Bumped version and set date.
* configure (txr_ver): Bumped.
* RELNOTES, txr.vim, dep.mk: Updated.
|
|
|
|
| |
the debug-disabled stub function needs six arguments.
|
|
|
|
|
|
|
|
|
| |
* configure: (need_svid_source, need_bsd_source): Variables removed.
(need_darwin_c_source): New variable. Detect Apple environment and add
-D_DARWIN_C_SOURCE, which is needed to reveal some functions in headers.
* signal.c (sig_init): Wrap #ifdefs around SIGPOLL; it is not defined
on Darwin.
|
|
|
|
|
| |
* arith.c (plus, minus, mul, trunc): Optimize cases
where bignum is opposite 1 or 0.
|
|
|
|
|
|
|
|
|
|
| |
(n_choose_k, n_perm_k): New functions.
* arith.h (n_choose_k, n_perm_k): Declared.
* eval.c (eval_init): New functions interned.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
so it doesn't have quotes around it.
(cum_norm_dist): New function.
* arith.h (cum_norm_dist): Declared.
* eval.c: Include arith.h.
(eval_init): Register cum_norm_dist as intrinsic.
* txr.1: Documented cum-norm-dist.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
in C headers which are extensions to standard C, like popen or fileno,
in response to standard feature selection macros like -D_POSIX_SOURCE.
MinGW and Cygwin are offenders. These platforms hide the declarations
when gcc is in -ansi mode, by testing for __STRICT_ANSI__. Turns out,
however, that -U__STRICT_ANSI__ on the gcc command line strips this
away, causing the declarations to be revealed.
* lib.c, parser.l, stream.c, utf8.c: Removed the declarations which
compensated for the above problem. Yippee! Fuck you, stupid Cygwin
troglodytes, and the MinGW horse you rode in on.
http://cygwin.com/ml/cygwin/2011-10/msg00131.html
|
|
|
|
|
|
|
|
| |
is retained as an obsolescent synonym. All arguments become optional.
* parser.l (lisp_parse): Handle nil source.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to _POSIX_C_SOURCE=199309L and _BSD_SOURCE.
In the .exe suffix test, try harder to redirect ls's output.
Test for fork stuff now needs <sys/types.h> evidently;
<unistd.h> does not necessarily pid_t, even though it defines
functions that return and accept pid_t!
The timegm test no longer needs _SVID_SOURCE since _BSD_SOURCE
covers it, and so we end up not using _SVID_SOURCE any more.
New tests for usleep and nanosleep.
The test for setenv is not conditional on timegm failing.
* eval.c: Include <time.h> and conditionally <windows.h>.
(usleep_wrap): New function.
(eval_init): New usleep_wrap function registered as usleep intrinsic.
* lib.c: Only define setenv and unsetenv if we don't have timegm,
because only in that situation they are used.
|
|
|
|
|
|
|
|
|
|
| |
language's expression evaluator. Whereas TXR Lisp expressions can be
used int the pattern language, preceded by @, it was not possible
to evaluate TXR Lisp variables this way. So instead of @var,
some clumsy trick had to be used like @(identity var). This is not
necessary any more. Code like @(next @*stdin*) will now work.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
than just fdefined.
* gc.c: Use #if HAVE_VALGRIND instaed of #ifdef HAVE_VALGRIND,
consistently with other HAVE_* config variables.
* lib.c: Likewise.
* lib.h: Likewise.
* txr.c: Likewise.
* txr.h: Likewise.
|
|
|
|
|
|
|
|
| |
* stream.c (vformat): Fix incorrect code for normalizing
exponent fields in the output of sprintf's floating-point
conversion. For ~e, the logic would let through a leading zero.
For ~a/~s conversion, it was comparing to 0 instead of '0',
not squashing leading zeros at all.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile: Use new EXE variable from config.mk.
* configure (exe, have_windows_h): New variables.
Handle situations with .exe suffix; on MiGW, the rm command
doesn't work on executables if the .exe suffix is not given.
New tests for localtime_r and gmtime_r.
* lib.c: Supply declarations which are missing on MinGW because
we use gcc -ansi, because MinGW doesn't follow established conventions
like -D_POSIX_SOURCE. Supply definitions for gmtime_r, localtime_r,
setenv and unsetenv.
* parser.l: Supply declarations which are missing on MinGW.
* signal.h (async_sig_enabled): Declare differently based on
HAVE_POSIX_SIGS.
Misspelled typedef fixed in the code for !HAVE_POSIX_SIGS
that has hitherto not been compiled.
(sig_mask): Wrap declaration in #ifdef HAVE_POSIX_SIGS because
it relies on sigset_t.
* stream.c: Supply declarations which are missing on MinGW.
Include <windows.h> if we have it.
(sleep): Define for Windows.
(statf): Handle missing st_blksize and st_blocks members in struct
stat.
(stream_init): Handle numerous missing S_* macros.
* utf8.c: Supply declarations which are missing on MinGW.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
on the same stream to extract multiple objects; the requirement
that the stream must hold exactly one complete Lisp object
with no following material is now lifted.
* parser.l (YY_INPUT): Modified the macro so that it reads no more
than one character. Though this probably makes the lexer less
efficient, it gives us the important property that the lexer does
not scan ahead into the input stream, hogging data into its buffer
which is then destroyed. This is essential if the lisp-parse function
is to support multiple calls to pull objects one by one out of
a stream.
* parser.y (spec): Use YYACCEPT in the SECRET_ESCAPE_E clause for
pulling a single expression out of the token stream. YYACCEPT
is a trick for not invoking the $accept : spec . $end production
which is implicitly built into the grammar, and which causes
a token of lookahead to occur. This allows us to read a full
expression without stealing any further token: but only if the
grammar is structured right.
(exprs): This phrase structure now handles the DOTDOT syntax.
There is no such thing as an expr DOTDOT expr expression any more;
it is in the list syntax (and not supported in the dot position).
(expr): Remove DOTDOT syntax.
* txr.1: Updated description of .. syntax, and relaxed the description
of lisp-parse since it now allows multiple calls to extract
multiple objects.
|
|
|
|
|
| |
have stray scanner state possibly interfering with a subsquent
parse job.
|
|
|
|
| |
* txr.vim: Regenerated.
|
|
|
|
|
|
|
| |
* configure: Avoid using "new" as identifier in signals test case.
* signal.c (set_sig_handler): Fix warning about { 0 } initializer.
(sig_mask): Avoid using "new" as identifier.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: we are using sigsetjmp but with a jmp_buf structure;
it requires sigjmp_buf!
Performance issue: sigsetjmp is a dog which makes system calls.
Solution: let's roll our own cached version of sigprocmask which
only calls the real sigprocmask when the mask changes. Then
our extended_setjmp will just use regular setjmp, plus our own
custom signal saving and restoring based on the cached version.
* signal.c (sig_blocked_cache): New variable.
(set_sig_handler): Use our sig_mask instead of sigprocmask.
(mem_set_bits, mem_clr_bits): New static functions.
(sig_mask): New function.
* signal.h (extended_jmp_buf): New member, blocked.
(extended_setjmp): save blocked signals by peeking into
sig_blocked_cache, and restore using sig_mask.
(sig_blocked_cache, sig_mask): Declared.
|
| |
|
|
|
|
| |
whenever offset is zero, regardless of whence argument.
|
| |
|
| |
|
|
|
|
|
|
| |
no effect if the variable already exists.
* txr.1: Documented defvar and lisp-parse.
|