diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-05-26 22:06:27 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-05-26 22:06:27 -0700 |
commit | e48572f574e24bae076c909c066f42c4d1f3b3aa (patch) | |
tree | ffea6bfc26da2650a2a6ae10a587573b636c1290 /Makefile | |
parent | 2c185d8d80caff9726ff560e3f3fc9fbf630c77e (diff) | |
download | txr-e48572f574e24bae076c909c066f42c4d1f3b3aa.tar.gz txr-e48572f574e24bae076c909c066f42c4d1f3b3aa.tar.bz2 txr-e48572f574e24bae076c909c066f42c4d1f3b3aa.zip |
First cut at new feature: gzip streams.
* Makefile (OBJS): Conditionally include new gzio.o object file.
* configure: Detect external zlib, setting up new have_zlib
variable in config.make, HAVE_ZLIB in config.h, and also -lz
in conf_ldlibs.
* gzio.[ch]: New files, implementing the stream abstraction
over the gzip file I/O routines in zlib.
* stream.h (struct stdio_mode): New gzip flag and gzlevel
bitfield to hold a value 0 to 9.
(stdio_mode_init_blank, stdio_mode_init_r, stdio_mode_init_rpb):
Update intializers to cover new bitfield members.
* stream.c: Include <zlib.h> and "gzio.h" if HAVE_ZLIB.
(do_parse_mode): Recognize new mode modifier letter "z",
setting the gzip flag in the mode structure. If it's followed
by a digit, set the gziplevel to that value.
(format_mode): Don't output "b" letter for binary mode if
gzip is set, because gzopen interprets "b" differently.
Don't put out "t" if gzip is set. If gzip mode is specified,
do put out the level. If gzip is set, and gziplevel is nonzero
then encode the level: gzopen will understand it.
(open_file): If gzip mode is requested, then open the file
using gzopen mode, a new function in gzio.c. The return a
gzio stream based on the returned gzip file handle. However,
if we are reading, and the gzip stream indicates that it's
not decompressing anything, then we close it and open the
file using an ordinary stream.
(stream_init): Call gzio_init if HAVE_ZLIB is true. This is done
here because the module is integrated with stream.c, and also
so that lib.c doesn't have to know about HAVE_ZLIB and <zlib.h>.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -64,6 +64,7 @@ OBJS-$(have_ftw) += ftw.o OBJS-$(have_posix_sigs) += signal.o OBJS-$(have_sockets) += socket.o OBJS-$(have_termios) += termios.o +OBJS-$(have_zlib) += gzio.o EXTRA_OBJS-$(add_win_res) += win/txr.res STDLIB_SRCS := $(wildcard stdlib/*.tl) |