summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2013-12-01 23:46:41 -0800
committerKaz Kylheku <kaz@kylheku.com>2013-12-01 23:46:41 -0800
commit980a1c1d78d838bbc13e90053ba90e02671878ae (patch)
treed059f1a9189b91205ebfb5118b4a9916383a7d76 /configure
parent360dc82e12c0031401b81f18e6b9108801277d69 (diff)
downloadtxr-980a1c1d78d838bbc13e90053ba90e02671878ae.tar.gz
txr-980a1c1d78d838bbc13e90053ba90e02671878ae.tar.bz2
txr-980a1c1d78d838bbc13e90053ba90e02671878ae.zip
Steps toward fixing an issue: lazy list readahead.
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.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure20
1 files changed, 20 insertions, 0 deletions
diff --git a/configure b/configure
index 51e067a9..3578d71f 100755
--- a/configure
+++ b/configure
@@ -1386,6 +1386,26 @@ else
have_unistd=y
fi
+printf "Checking for isatty function ... "
+
+cat > conftest.c <<!
+#include <unistd.h>
+
+int main(void)
+{
+ isatty(0);
+ return 0;
+}
+!
+rm -f conftest
+if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then
+ printf "no\n"
+else
+ printf "yes\n"
+ printf "#define HAVE_ISATTY 1\n" >> config.h
+ have_unistd=y
+fi
+
#
# Dependent variables
#