| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem is that accurate lazy lists are not suitable for
real time use, where we want the TXR program to respond immediately
to matching some datum.
I'm implementing a simple, naive variant of lazy stream lists
which simply populates the lazy cons by reading from the stream when
the car or cdr fields are accessed. This type of stream can never
be nil (empty list) even if the file is empty; in that case
it will be (nil) and in general, it will have a spurious nil
item at the end instead of ending in a string.
(An adjustment was made in match.c to detect this; more
will be needed.)
I'm adding attributes to streams so streams can now have a
"real-time" attribute. When a lazy string list is constructed over
a real-time stream, the simple implementation is used.
File streams are automatically real-time if (on Unix) they are tied
to tty streams. Tail streams are also real-time.
More work is needed to achieve the goal of this change,
but this is a big step in the right direction.
* configure: Detect isatty function.
* lib.c (simple_lazy_stream_func): New static function.
(lazy_stream_cons): Use simple implementation for real-time streams.
* match.c (match_files): Do not call match_line_completely
with a data line that is nil (as a result of simple lazy list
over a real-time stream). A nil item in a lazy list of strings
is treated as eof.
* stream.c (real_time_k): New symbol variable.
(struct strm_ops): New members: get_prop, set_prop.
(struct stdio_handle): New member: is_real_time.
(stdio_get_prop, stdio_set_prop): New static function.
(stdio_ops, tail_ops, pipe_ops): stdio_get_prop and
stdio_set_prop funtions wired in.
(make_stdio_stream_common): Attribute streams as real-time
if they are tty devices.
(make_tail_stream): Tail streams are real-time attributed.
(stream_set_prop, real_time_stream_p): New functions.
(stream_init): Initialize real_time_k.
* stream.h (real_time_k): Declared.
(real_time_stream_p, stream_set_prop): Likewise.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
and count_if registered as intrinsics.
* lib.c (countqual, countql, countq, count_if): New functions.
* lib.h (countqual, countql, countq, count_if): Declared.
* txr.1: New functions documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
have stricter diagnosis for configure tests.
(have_timegm, need_svid_source, need_bsd_source): New
variables. sys/stat.h test only declares static data and
compiles an object file. Adding tests for timegm, tzset,
setenv and unsetenv.
* eval.c (eval_init): Register new intrinsic, make_time_utc.
* lib.c (make_time_impl): New static function.
(make_time): Reimplemented as call to make_time_impl.
(timegm_hack): New conditionally-defined static function.
(make_time_utc): New function.
* lib.h (make_time_utc): Declared.
* txr.1: make-time-utc documented.
|
|
|
|
|
| |
month for the tm_mon member of struct tm; we
were adding 1 instead.
|
|
|
|
|
|
| |
(tail_strategy): Handle the situation when the file disappears. We
cannot throw an error, but must poll the filesystem
for the file to reappear.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c: Include <unistd.h> conditionally.
(errno_wrap, daemon_wrap): New functions.
(eval_init): Registered errno_wrap and daemon_wrap as intrinsics
under the names daemon and errno.
* txr.1: Documented errno and daemon in new UNIX PROGRAMMING
section.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adding wrapper for mktime.
* eval.c (apply): Handle function codes N5 through N7.
(eval_init): Register make_time as intrinsic.
* lib.c (auto_k): New keyword symbol variable.
(equal, generic_funcall): Handle N5-N7.
(func_n5, func_n6, func_n7, func_n5v, func_n6v, func_n7v): New
functions.
(obj_init): Initialize auto_k.
(make_time): New function.
* lib.h (functype_t): New enum members: N5, N6, N7.
(struct func): New members: n5, n6, n7, n5v, n6v, n7v.
(auto_k, func_n5, func_n6, func_n7, func_n5v, func_n6v, func_n7v,
make_time): Declared.
|
|
|
|
| |
mode member of struct stdio_ops to nil.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(stdio_stream_mark): Mark the new member during gc.
(stdio_seek): When we seek, we should reset the utf8 machine.
(tail_strategy): New function.
(tail_get_line, tail_get_char, tail_get_byte): Use
tail_strategy for polling the file at EOF.
(open_tail): Store the mode in the file handle.
* utf8.c (w_freopen): New function.
* utf8.h (w_freopen): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile (conftest.clean): Use @ to suppress output.
* configure (have_unistd): New variable. Set true by every successful
test that compiles something that contains #include <unistd.h>.
HAVE_UNISTD_H is conditionally generated in config.h based on this variable.
Minor cleanup.
* parser.l: Inclusion of <unistd.h> wrapped in #if/#endif.
* stream.c: Conditional inclusion of <unistd.h> based on new HAVE_UNISTD_H symbol.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register new open_tail function as intrinsic.
* match.c (complex_snarf, complex_stream): Update calls to
make_stdio_stream and make_pipe_stream to take fewer arguments.
(match_files): Support a stream object as a data source specification
in place of a string.
* parser.l (parse_reset): Update call to make_stdio_stream to take
fewer arguments.
* stream.c: Inclusion of <unistd.h> made properly conditional.
(struct stdio_handle): pid member defined as pid_t only if we have fork
functionality, otherwise defined as int.
(tail_get_line, tail_get_char, tail_get_byte): New static functions.
(tail_ops): New static structure.
(make_stdio_stream_common): New static structure.
(make_stdio_stream, make_pipe_stream): These functions lose the input
and output parameters, which ended up never used. Reimplemented
in terms of new common function.
(make_tail_stream): New function.
(make_pipevp_stream): Reimplemented in terms of new common function.
(open_file, open_command): Simplified by removal of useless local
variables and their computation, which used to be extra arguments to
make_stdio_stream and make_pipe_stream.
(open_tail): New function.
(stream_init): Calls to make_stdio_stream updated.
* stream.h (make_stdio_stream, make_pipe_stream): Declarations updated.
(make_tail_stream, open_tail): Declared.
* txr.c (txr_main): Calls to make_stdio_stream updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bugfix in stdio_flush: check FILE * handle for null.
Minor cleanups.
* eval.c (eval_init): Register seek_stream as intrinsic.
* stream.c (from_start_k, from_current_k, from_end_k): New symbol
variables.
(strm_whence): New enum.
(strm_ops): New member, seek.
(stdio_maybe_write_error): Renamed to stdio_maybe_error; takes
new string argument to describe action.
(stdio_put_string, stdio_put_char, stdio_put_byte): Updated call to
stdio_maybe_error.
(stdio_flush): Updated call to stdio_maybe_error. Check
handle for null.
(stdio_seek): New static function.
(stdio_ops): Added stdio_seek.
(pipe_ops, string_in_ops, byte_in_ops, string_out_ops,
strlist_out_ops, dir_ops): Added explicit zero entries and comments for
unimplemented functions.
(seek_stream): New function.
(stream_init): New keyword symbols interned.
* stream.h (from_start_k, from_current_k, from_end_k): New
variables declared.
(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, s_ifmt, s_iflnk,
s_ifreg, s_ifblk, s_ifdir, s_ifchr, s_ififo, s_isuid, s_isgid, s_isvtx,
s_irwxu, s_irusr, s_iwusr, s_ixusr, s_irwxg, s_irgrp,
s_iwgrp): Existing extern variables declared.
(seek_stream): New function declared.
* txr.1: Documented seek-stream.
|
|
|
|
|
|
| |
subcases of a successful load. This bug means that a loaded TXR
sub-query was not reliably able to bind variables that are then visible
to subsquent directives in the parent.
|
|
|
|
| |
* txr.vim: Updated.
|
|
|
|
|
|
|
|
|
| |
This is used for reporting the current match location in debug traces.
* match.c (mf_all): Takes new argument curfiles
and initializes the match_files_ctx member of the same name.
(do_match_line, mf_from_ml, match_filter, match_fun, extract):
Pass curfile to ml_all.
|
|
|
|
|
|
| |
* added, and also add the missing rep to these.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
| |
* txr.c (version): Bumped.
* txr.1: Bumped version and set date.
* configure (txr_ver): Bumped.
* RELNOTES: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
propagate bindings. The culprit? The bindings_coll variable in the
v_collect function being indeterminate by the well-documented and
understood action of setjmp. Marking the bindings_coll variable
volatile instantly fixed it. I reviewed this code to find any other
instance of this oversight.
* match.c (v_skip, v_collect): Mark some local variable volatile:
precisely those which are used after possibly returning via an
unwind, and which might have been modified since setting up
the unwind block.
|
|
|
|
|
|
| |
and also ones with underscores.
* txr.vim: Updated.
|
|
|
|
|
|
|
|
| |
(conftest.clean): New target.
* configure: Use "make conftest.clean" to clean up conftest stuff. Note
that there was a bug here: brace expansion was used, but the shell is
/bin/sh, so conftest.err wasn't being removed.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
syntax appears in an op form, crashing the expander with infinite
recursion at program load time, before the code is run.
* eval.c (transform_op): The fi == var check to handle a
trailing op variable in the dot position of a form
needs to ensure that it really is @<num> type var, and
not the @<sym> type for instance.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the 022 release.
Efficient string literal objects (tag bits 11) were introduced on that
day.
The null_string object was changed to a literal, and that object is
efficiently returned by some string manipulation functions in cases
when it is obvious that the result is an empty string.
However, the LIT type code was not added to a switch statement in
the variable matching code, which continued to recognize only the
type STR as a string, to this day.
A test case for this is
echo ":x" | ./txr -c "@x:@x" -
which results in an "unsupported object in spec" error.
* match.c (h_var): Use stringp to test for string rather than
type(..) == STR. Add LIT and LSTR to the switch statement
so that literals an lazy strings are handled if they occur.
(do_output_line): Add LIT and LSTR to switch.
|
| |
|
|
|
|
|
|
| |
sources because actions aren't registered for them.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
deviations from C90, like mixed declations and
statements. GCC doesn't diagnose these without the
--pedantic flag.
* configure: GCC's --ansi flag should be spelled -ansi.
* lib.c (split_str, obj_print): Reorder declaration before statements.
(make_sym): Fix similar problem by eliminating a statement.
(funcall1, funcall2, funcall3, funcall4): Use assignment to initialize
local array with non-constant elements. This is actually good for
performance because we only initialize those parts of the array that
we use.
* lib.h (struct func): Change functype member to unsigned,
since enum-typed bitfields are a GCC extension.
* match.c (ml_all, mf_all): Use assignments to initialize local
struct with non-constants.
(do_txeval, v_collect): Slightly revise unwinding macrology with help
of new macros to avoid mixing declarations and statements.
(spec_bind): Removed spurious semicolon from macro expansion.
(v_gather): Reorder two lines to avoid mixed decls and
statements.
(match_filter): Move declaration of ret a few lines up, ahead of
statements.
* unwind.c (uw_pop_until): New function.
* unwind.h (uw_pop_until): Declared.
(uw_mark_frame, uw_fast_return): New macros.
|
|
|
|
| |
* txr.vim: Updated.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
arguments is a right-associative reduction, not left.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
output blocks across the same stream.
* match.c (close_s, named_k, continue_k, finish_k): New symbol
variables.
(v_output): Implement :named, :finish and :continue.
(v_close): New static function.
(syms_init): New symbols interned.
(dir_tables_init): New entry associating v_close
function with symbol stored in close_s.
* match.h (close_s): Declared.
* txr.1: New features documented.
|
|
|
|
| |
* and time-string-utc.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Explicitly specifying @rest using (op ... . @rest)
did not work at all.
The then-func agument of iff and iffi may now be nil.
* eval.c (format_op_arg): New static function.
(transform_op): Handle dotted lists ending in @rest
or @<num>.
(supplement_op_syms): New static function.
(expand_op): Add missing numeric arguments,
so that all 1 through n are in the list.
Trailing rest is now added under different
conditions.
* lib.c (do_iff): Give thenfun the same
behavior on nil that elsefun enjoys.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
block, for specifying variables to include in iteration whose
presence repeat is not able to deduce.
* match.c (extract_bindings): New argument, vars, specifies
additional variables to consider.
(do_output_line, do_output): Process :vars argument of repeat
and rep directive.
* txr.1: Updated.
|
|
|
|
| |
used 4 space tabs and utf8.c used 8 space tabs, inconsistently.
|
| |
|
|
|
|
|
|
|
| |
txr.1: Documented line continuation for string literals,
supported since Version 38 but not clarified properly.
RELNOTES: Updated.
|
|
|
|
|
|
| |
literals and quasiliterals and after @\.
Support "\ " (backslash space) escape in string literals
and quasiliterals.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* txr.c (version): Bumped.
* txr.1: Bumped version, set date and documented string-cmp.
* configure (txr_ver): Bumped.
* eval.c (eval_init): Forgotten string-cmp registered as intrinsic.
* txr.vim: Highlighting for string-cmp.
* RELNOTES: Updated.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(v_require): New static function.
(syms_init): Initialize require_s.
(dir_tables_init): Add new entries into v_directive_table
and h_directive_table for new require directive.
* match.h (require_s): Declared.
* txr.1: Added do and require directives to the directive summary
section. Documented new require directive.
Fixed int-str documentation to clarify that the radix is
optional.
|
|
|
|
|
|
|
|
| |
* lib.c (tok_str): New parameter, keep_sep.
* lib.h (tok_str): Declaration updated.
* txr.1: Documentation for tok-str updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added lazy-stringp. Changing names of length-str-{gt,ge,lt,le}
to be consistent with the >, >=, < and <= functions.
* lib.c (lazy_stream_func): Greatly simplified implementation.
The lazy list now continues by means of recursing via
an optimized version of lazy_stream_cons called lazy_stream_cont.
The environment structure is simplified to just hold the next item,
rather than a pointless list. The pointless setting of lcons->lc.func
to nil is also removed; this is always done by the caller.
(lazy_stream_cont): New static function, similar to lazy_stream_cons,
but optimized by not consing up a new function and new environment
cell.
(lazy_stream_cons): The environment for the update function
is simplified to just a single cons.
* txr.1: Documented lazy string functions and lazy-stream-cons.
|