| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* METALICENSE: 2020 copyrights bumped to 2021. Added note
about SHA-256 routines from Colin Percival.
* LICENSE, LICENSE-CYG, Makefile, alloca.h, args.c, args.h,
arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, chksum.c,
chksum.h, chksums/crc32.c, chksums/crc32.h, combi.c, combi.h,
configure, debug.c, debug.h, eval.c, eval.h, ffi.c, ffi.h,
filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h,
hash.c, hash.h, itypes.c, itypes.h, jmp.S, lex.yy.c.shipped,
lib.c, lib.h, linenoise/linenoise.c, linenoise/linenoise.h,
lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c,
regex.h, share/txr/stdlib/asm.tl, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/compiler.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/copy-file.tl, share/txr/stdlib/debugger.tl,
share/txr/stdlib/defset.tl, share/txr/stdlib/doloop.tl,
share/txr/stdlib/each-prod.tl, share/txr/stdlib/error.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/param.tl,
share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl,
share/txr/stdlib/pmac.tl, share/txr/stdlib/quips.tl,
share/txr/stdlib/save-exe.tl, share/txr/stdlib/socket.tl,
share/txr/stdlib/stream-wrap.tl, share/txr/stdlib/struct.tl,
share/txr/stdlib/tagbody.tl, share/txr/stdlib/termios.tl,
share/txr/stdlib/trace.tl, share/txr/stdlib/txr-case.tl,
share/txr/stdlib/type.tl, share/txr/stdlib/vm-param.tl,
share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, socket.c, socket.h, stream.c, stream.h,
struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h,
syslog.c, syslog.h, termios.c, termios.h, time.c, time.h,
tree.c, tree.h, txr.1, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h, vm.c, vm.h, vmop.h, win/cleansvg.txr,
y.tab.c.shipped: Copyright year bumped to 2021.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As a result of this change, the startup time is reduced.
The command txr -e '(compile-toplevel nil)' shows a 54%
speedup: around 110 milliseconds down from around 170.
Programs that read large amounts of TXR Lisp data will
benefit.
* parser.l (YY_INPUT): Use new get_bytes function instead of
get_byte to read a buffer at a time.
* stream.c (get_bytes): New function.
* stream.h (get_bytes): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In this commit, the put_buf and fill_buf stream virtual
functions are changed to operate directly on a low-level
buffer, rather than a stream. This will allow these functions
to be used for improving the performance of I/O operations
that are not related to buffer objects.
* stream.h (struct strm_ops): Change type signature of put_buf
and fill_buf members. The lengths and iszes are ucnum.
The return value is ucnum. The buffer is passed as a pointer
and length, rather than a buffer object.
* stream.c (unimpl_put_buf, unimpl_fill_buf, generic_put_buf,
generic_fill_buf, stdio_put_buf, stdio_fill_buf,
delegate_put_buf, delegate_fill_buf): Adjust to
new interface.
(put_buf, fill_buf, fill_buf_adjust): Pull the poitner and
size from the buffer and pass those down to the virtual
functions rather than the buffer itself. Convert ucnum return
value to val.
* strudel.c (strudel_put_buf, strudel_get_buf): The struct
delegate interface doesn't change. The put-buf and fill-buf
methods still operate on buffer objects. To glue that with the
new low-level interface, we use the init_borrowed_buf trick
that is was first used in ffi.c: temporary buf objects are
efficiently allocated on the stack, pointing to the same
memory that is coming down from the stream operation.
* txr.1: Document the new restrictions on the buf argument of
the put-buf and fill-buf stream delegate methods.
Since the buf not a heap object, it cannot be used after the
method returns.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* buf.c (buf_put_bytes, buf_get_bytes): static functions
become external.
* buf.h (buf_put_bytes, buf_get_bytes): Declared.
* stream.c (get_line_as_buf): New fucntnion.
(stream_init): Registered get-line-as-buf intrinsic.
* stream.h (get_line_as_buf): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (w_fopen_mode): Special handling via open and
fdopen is now required if either the m.notrunc or m.nonblock
is present. Since m.nonblock is just an option that can be
used with any open mode, we must handle the mode flags more
fully, to generate more possible combinations of open flags.
(do_parse_mode): Check for 'n', and set nonblock flag.
* stream.h (struct stdio_mode): New member, nonblock.
(stdio_moe_init_blank, stdio_mode_init_r,
stdio_mode_init_rpb): Update initalizers to set nonblock to
zero.
* txr.1: Documented, and also added missing i option to the
mode string syntax grammar summary.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the sixth round of an effort to enable GCC's -Wextra
option. Warnings about uninitialized members are addressed.
I am not happy with what had to be done in linenoise.c.
We just need a dummy circular list node for the lino_list,
which we achieved with a dummy all zero struture, with
statially initialized next and prev pointers. There are way
too many members to initialize, including one that has struct
termios type containing a nonportable set of members.
On the plus size, the lino_list structure now moves into the
BSS section, reducing the executable size slightly.
* lib.c (cptr_ops): Initialize using cobj_ops_init, which has
all the initializers already, and should have been used for
this in the first place.
* linenoise/linenoise.c (lino_list): Remove initializer,
which eliminates the warning about some members not being
initialized.
(lino_init): Initialize the next and prev pointers here.
* parser.c (parser_ops): Initialize with cobj_ops_init.
* stream.h (stdio_mode_init_blank, stdio_mode_init_r,
stdio_mode_init_rpb): Add initializer corresponding to redir
array member of struct stdio_mode.
* sysif.c (cptr_dl_ops): Use cobj_ops_init.
* tree.c (tree_iter_init): Add initializer for the path
array member of struct tree_iter.
(tr_rebuild): Initialize all fields of the dummy object.
Since it's a union, we just have to deal with the any
member. There are two layouts for the obj_common fields
based on whether CONFIG_GEN_GC is enabled. This is ugly, but
occurs in one place only.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Quite surprisingly ISO C lacks a way in fopen to open a file
for writing such that it is not truncated if it already
exists, and not opened in append mode.
(But you will be glad to know that ISO C is adding incredibly
useful features in this area, like Microsoft's fopen_s!)
Let us add modes "m" and "m+" which will be like "w" and "w+",
but without the truncation to zero length (no O_TRUNC
is passed to open).
* stream.c (w_fopen_mode): New static function.
(open_file, open_tail, tail_strategy): Use w_fopen_mode
instead of directly calling w_fopen.
(do_parse_mode): Handle 'm' and set new notrunc flag.
* stream.h (struct stdio_mode): New member, notrunc flag.
(stdio_mode_init_blank, stdio_mode_init_r,
stdio_mode_init_rpb): Initializer macros updated to include
initializer for notrunc flag.
* txr.1: Documented "m" mode.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, alloca.h, args.c,
args.h, arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h,
chksum.c, chksum.h, chksums/crc32.c, chksums/crc32.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c,
ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c,
glob.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c,
lib.h, linenoise/linenoise.c, linenoise/linenoise.h,
lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c,
regex.h, share/txr/stdlib/asm.tl, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/compiler.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/debugger.tl, share/txr/stdlib/defset.tl,
share/txr/stdlib/doloop.tl, share/txr/stdlib/error.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/param.tl,
share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl,
share/txr/stdlib/pmac.tl, share/txr/stdlib/save-exe.tl,
share/txr/stdlib/socket.tl, share/txr/stdlib/stream-wrap.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl,
share/txr/stdlib/termios.tl, share/txr/stdlib/trace.tl,
share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl,
share/txr/stdlib/vm-param.tl,
share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, socket.c, socket.h, stream.c, stream.h,
struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h,
syslog.c, syslog.h, termios.c, termios.h, tree.c, tree.h,
txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c,
vm.h, vmop.h, win/cleansvg.txr: Extended copyright notices
to 2020.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the mode-string of open-process, I/O redirections can now
be specified that are carried out in the child process.
* stream.c (do_parse_mode): Parse the redirection syntax
indicated by >, which has a short and long form.
The redirections are entered into a small table in the mode
structure.
(open_process): In the child process, perform the redirection
specified in the mode structure's redirection table.
* stream.h (STDIO_MODE_NREDIRS): New preprprocessor symbol.
(struct stdio_mode): New array member, redir.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The base-name function now takes a second argument which is
optional, specifying a suffix to be removed. The behavior is
similar to that of the second argument of the POSIX basename
command.
* stream.c (base_name): Second argument added. If present, the
returned value is adjusted by trimming the suffix, unless that
would cause an empty string to be returned.
(stream_init): Update registration of base-name intrinsic.
* stream.h (base_name): Declaration updated.
* txr.1: New base-name parameter documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* chksum.c (sha256_stream): Use iobuf_get and iobuf_put.
* gc.c (gc): Do not mark the list of recycled buffers; just
consider them to be garbage and clear the list, like we do
with recycled conses via rcyc_empty.
* stream.c (iobuf_free_list): New static variable.
(iobuf_get, iobuf_put, iobuf_list_empty): New functions.
* stream.h (iobuf_get, iobuf_put, iobuf_list_empty): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* filter.c (base64_encode): Handle an object of either string
or buffer type by using make_byte_input_stream.
(base64_decode_buf): New function.
(filter_init): Register base64-decode-buf intrinsic.
* filter.h (base64_decode_buf): Declared.
* stream.c (make_byte_input_stream): New function.
* stream.h (make_byte_input_stream): Declared.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_print_op): Implement max length.
* lib.c (lazy_str_put, out_lazy_str): Take struct strm_base *
parameter and implement max length.
(out_quasi_str_sym): Don't use obj_print_impl for symbol's
name string; just put_string. The use of obj_print_impl causes
symbols appearing as variables in quasiliterals to be
truncated when max length is imposed.
(out_quasi_str): Implement max length.
(obj_print_impl): Implement max length and depth. Note that
there is now always a non-null ctx pointer.
(obj_print): Always set up context pointer for obj_print_impl.
Context now has pointer to low-level stream structure, where
we can access max_length and max_depth. It also carries the
recursion depth.
* lib.h (lazy_str_put): Declaration updated.
* stream.c (strm_base_init): Add initializers for max_length
and max_depth.
(put_string): Pass stream structure to lazy_str_put.
(set_max_length, set_max_depth): New functions.
(stream_init): set-max-length and set-max-depth intrinsics
registered.
* stream.h (struct strm_ctx): New members depth and strm.
(struct strm_base): New members max_length and max_depth.
(set_max_length, set_max_depth): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The fourth indent mode indent-foff (force off) is introduced.
* buf.c (buf_print): Turn on data mode indentation if
the current mode is not indent-foff, rather than when it
is indent-off.
* lib.c (obj_print_impl): The unconditional set_indent_mode
calls are replaced with test_neq_set_indent_mode so we only
set the mode if it is not forced off.
* stream.c (formatv): For the ! directive, turn on data
mode identation is not indent-foff, rather than when it is
indent-off.
(put_string, put_char, width_check): Recognize ident-foff as
indentation off.
(test_neq_set_indent_mode): New function.
(stream_init): Register test-neq-set-indent-mode function
and indent-foff variable.
* stream.h (indent_mode): New enum constant, indent_foff.
(test_neq_set_indent_mode): Declared.
* struct.c (struct_inst_print): Turn on data mode indentation
if the current mode is not indent-foff, rather than when it is
indent-off.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
* stream.c (fill_buf_adjust): New function.
(stream_init): Register fill-buf-adjust intrinsic.
* stream.h (fill_buf_adjust): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, args.c, args.h,
arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c,
ffi.h, filter.c, filter.h, ftw.h, gc.c, gc.h, glob.c, glob.h,
hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c, lib.h,
lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c,
regex.h, share/txr/stdlib/asm.tl, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/compiler.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/doloop.tl, share/txr/stdlib/error.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/path-test.tl,
share/txr/stdlib/place.tl, share/txr/stdlib/pmac.tl,
share/txr/stdlib/socket.tl, share/txr/stdlib/stream-wrap.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl,
share/txr/stdlib/termios.tl, share/txr/stdlib/trace.tl,
share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl,
share/txr/stdlib/vm-param.tl, share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, socket.c, socket.h, stream.c, stream.h,
struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h,
syslog.c, syslog.h, termios.c, termios.h, txr.1, txr.c, txr.h,
unwind.c, unwind.h, utf8.c, utf8.h, vm.c, vm.h, vmop.h,
win/cleansvg.txr: Extended Copyright line to 2018.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The <dirent.h> header is included all over the place because
it is needed by a single declaration in stream.h. That
declaration is for a function that is only called within
stream.c, so we make it internal. Now only stream.c has
to include <dirent.h>.
* buf.c, debug.c, eval.c, ffi.c, filter.c, gc.c, gencadr.txr,
hash.c, lib.c, lisplib.c, match.c, parser.c, regex.c, socket.c,
struct.c, strudel.c, sysif.c, syslog.c, termios.c, txr.c,
unwind.c, vm.c: Remove #include <dirent.h>.
* cadr.c: Regenerated.
* stream.c (make_dir_stream): Make external function static.
* stream.h (make_dir_stream): Declaration updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is an issue with the printer in that it produces
output whereby objects continue on the same line after
a multi-line object, e.g:
(foo (foobly bar
xyzzy quux) (oops same
line))
rather than:
(foo (foobly bar
xyzzy quux)
(oops same line))
There is a simple fix for this: set a flag to force
a line break on the next width-check operation whenever
an object has been broken into multiple lines.
width-check can return a Boolean indication whether
it generated a line break, and so aggregate object
printing routines can tell whether their object
has been broken into lines, and set the flag.
* stream.h (struct strm_base): New member, force_break.
(force_break): Declared.
* stream.c (strm_base_init): Extent initializer to cover
force_break flag.
(put_string, put_char): Clear the force_break flag whenever
we hit column zero.
(width_check): If indent mode is on, and force_break is
true, generate a break. Clear force_break.
(force_break): New function.
(stream_init): Register force-break intrinsic.
* buf.c (buf_print): Set the force break flag if the buffer
was broken into multiple lines.
* hash.c (hash_print_op): Set the force break flag if the
hash was broken into multiple lines.
* lib.c (obj_print_impl): Same logic for lists.
* struct.c (struct_inst_print): Same logic for structs.
* tests/009/json.expected, tests/011/macros-2.expected,
tests/012/struct.tl, tests/017/glob-zarray.expected:
Update expected textual output to reflect new formatting.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, args.c, args.h,
arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c,
ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c,
glob.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c,
lib.h, lisplib.c, lisplib.h, match.c, match.h, parser.c,
parser.h, parser.l, parser.y, protsym.c, rand.c, rand.h,
regex.c, regex.h, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/conv.tl, share/txr/stdlib/doloop.tl,
share/txr/stdlib/error.tl, share/txr/stdlib/except.tl,
share/txr/stdlib/ffi.tl, share/txr/stdlib/getopts.tl,
share/txr/stdlib/getput.tl, share/txr/stdlib/hash.tl,
share/txr/stdlib/ifa.tl, share/txr/stdlib/keyparams.tl,
share/txr/stdlib/op.tl, share/txr/stdlib/package.tl,
share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl,
share/txr/stdlib/pmac.tl, share/txr/stdlib/socket.tl,
share/txr/stdlib/stream-wrap.tl, share/txr/stdlib/struct.tl,
share/txr/stdlib/tagbody.tl, share/txr/stdlib/termios.tl,
share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl,
share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, socket.c, socket.h, stream.c, stream.h,
struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h,
syslog.c, syslog.h, termios.c, termios.h, txr.1, txr.c, txr.h,
unwind.c, unwind.h, utf8.c, utf8.h, win/cleansvg.txr:
Extended Copyright line to 2018.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A new kind of stream object which redirects its operations to
the methods of a structure.
* Makefile (OBJS): New object file, strudel.o.
* lib.c (init): Call new strudel_init function.
* lisplib.c (stream_wrap_set_entries,
stream_wrap_instantiate): New static functions.
(lisplib_init): Arrange for autloading of new stream-wrap.tl.
* share/txr/stdlib/stream-wrap.tl: New file.
* stream.c (put_string_s, put_char_s, put_byte_s, get_line_s,
get_char_s, get_byte_s, unget_char_s, unget_byte_s, put_buf_s,
fill_buf_s, flush_s, seek_s, truncate_s, get_prop_s,
set_prop_s, get_error_s, get_error_str_s, clear_error_s,
get_fd_s): New symbol variables.
(stream_init): New symbol variables initialized. Numerous
functions registered via these variables now rather than
intern(...) expressions.
* stream.h (put_string_s, put_char_s, put_byte_s, get_line_s,
get_char_s, get_byte_s, unget_char_s, unget_byte_s, put_buf_s,
fill_buf_s, flush_s, seek_s, truncate_s, get_prop_s,
set_prop_s, get_error_s, get_error_str_s, clear_error_s,
get_fd_s): Declared.
* strudel.c, strudel.h: New files.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, using "rb" in open-command reports an error on
GNU/Linux, due to popen not liking the "b" mode.
On Cygwin, the "b" flag is useful with popen.
* stream.c (normalize_mode_no_bin): New function.
(open_command): Use normalize_mode_no_bin instead of
normalize_mode to strip out the binary flag.
This doesn't happen on Cygwin, though.
* stream.h (normalize_mode_no_bin): Declared.
* share/txr/stdlib/getput.tl (command-get-buf): Since
we are getting binary data, pass the "rb" mode to
open-command, now that it works.
(command-put-buf): Add "b" flag to mode passed
to open-command.
|
|
|
|
|
| |
* stream.h (enum strm_whence): Fix strm_end and strm_start
being duplicate values; strm_end must map to SEEK_END.
|
|
|
|
|
|
|
|
|
| |
* stream.c (path_cat): New function.
(stream_init): Registered path_cat.
* stream.h (path_cat): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.h (struct strm_ops): put_buf and fill_buf function
pointers get third argument to indicate starting position
of read and write.
(put_buf, fill_buf): Declarations updated.
* stream.c (unimpl_put_buf, unimpl_fill_buf): Third argument
added.
(generic_put_buf, generic_fill_buf, stdio_put_buf,
stdio_fill_buf): Implement position
argument.
(delegate_put_buf, delegate_fill_buf): Take third argument,
pass it down.
(put_buf, fill_buf): New position argument in second position.
Defaulted to zero. Passed down.
(stream_init): Updated registration of put-buf and fill-buf.
* txr.1: Updated documentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.h (struct strm_ops): New function pointer members,
put_buf and fill_buf.
(strm_ops_init): Two new parameters in macro.
(put_buf, fill_buf): Declared.
* stream.c (unimpl_put_buf, unimpl_fill_buf, generic_put_buf,
generic_fill_buf): New static functions.
(fill_stream_ops): Default new fill_buf and fill_buf virtual
functions intelligently based on whether get_byte and put_byte
are available.
(stdio_put_buf, stdio_fill_buf): New static functions.
(stdio_ops, tail_ops, pipe_ops, dir_ops, string_in_ops,
byte_in_ops, strlist_in_ops, string_out_ops, strlist_out_ops,
cat_stream_ops): Add arguments to strm_ops_init macro for
get_buf and fill_buf.
(delegate_put_buf, delegate_fill_buf): New static functions.
(record_adapter_ops): Add arguments to strm_ops_init macro
for get_buf and fill_buf.
(put_buf, fill_buf): New functions.
(stream_init): Register put-buf and fill-buf intrinsics.
* socket.c (dgram_strm_ops): Add arguments to strm_ops_init
macro call.
* syslog.c (syslog_strm_ops): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (path_sep_chars): New global variable.
(detect_path_separators): New static function.
(base_name, dir_name): New functions.
(stream_init): Call detect_path_separators. Register base-name
and dir-name intrinsic functions, and path-sep-chars variable.
* stream.h (path_sep_chars, base_name, dir_name): Declared.
* txr.c (dirname): Static function removed.
(sysroot_init): Use dir_name instead of dirname.
* txr.1: Documented dir-name, base-name and path-sep-chars.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The obj printer is ignoring the pretty flag when rendering
floating-point numbers, and just formatting them using
*print-flo-format*.
To address this issue, we introduce an additional
*pprint-flo-format* variable.
* lib.c (obj_print_impl): In the FLNUM case, use either
the value of *print-flo-format* or *pprint-flo-format* based
on the value of the pretty flag.
* stream.c (pprint_flo_format_s): New symbol variable.
(stream_init): Initialize pprint_flo_format_s with interned
symbol *pprint-flo-format* and register this as a special
variable.
* stream.c (pprint_flo_format_s): Declared.
* txr.1: Documented *pprint-flo-format*. Also put in a
note in the description of the various print functions
that the equivalences based on ~s and ~a only apply
to floats when the special variables have their original
values.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, args.c, args.h,
arith.c, arith.h, cadr.c, cadr.h, combi.c, combi.h, configure,
debug.c, debug.h, eval.c, eval.h, filter.c, filter.h, ftw.c,
ftw.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h, jmp.S,
lib.c, lib.h, lisplib.c, lisplib.h, match.c, match.h,
parser.c, parser.h, parser.l, parser.y, rand.c, rand.h,
regex.c, regex.h, signal.c, signal.h, stream.c, stream.h,
struct.c, struct.h, sysif.c, sysif.h, syslog.c, syslog.h,
termios.c, termios.h, txr.1, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/conv.tl, share/txr/stdlib/except.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/path-test.tl,
share/txr/stdlib/place.tl, share/txr/stdlib/socket.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl,
share/txr/stdlib/termios.tl, share/txr/stdlib/txr-case.tl,
share/txr/stdlib/type.tl, share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl:
Add 2017 to all copyright headers and strings.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Two issues addressed here, both occurring when *print-circle*
is enabled and an object has struct components which have a
custom print method that re-enters the object printer.
One issue is that the children of these components which occur
just once print with spurious labels: like #3=, when no
matching #3# occurs. The other bug is a wrong "unexpected
duplicate object" exception caused by mismanagement of the
child object's label hash table and its merging with the parent.
* stream.h (struct stream_ctx): New member, obj_hash_prev.
Makes the parent hash table known to populate_obj_hash,
if there is a table, otherwise nil.
* lib.c (populate_obj_hash): If there is a parent table, check
each object in it. If it occurs, then bail. I.e. don't add
objects to the child table which occur in the parent. This
fixes both issues. Also, we do the unexpected duplicate object
check right here now: if we traverse an object that already
printed without a label (because it is not known to be
duplicate), that means that a custom print method is
inappropriately introducing new references to existing
objects, contrary to the rules. (obj_hash_merge): The logic
here is now simplified. All entries in the child table are
simply moved to the parent. If anything already exists, that
is an unexpected stuation indicating an internal problem,
turned into a variant of the unexpected duplicate object
message.
* tests/012/circ.tl: New file, giving tests for the bugs.
* tests/012/circ.expected: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is some infrastructure which will support *print-circle*.
* lib.h (struct strm_ctx): Forward declared.
(struct cobj_ops): Add context parameter to print function
pointer.
(cobj_print_op, obj_print_impl): Add context parameter to
declarations.
* hash.c (hash_print_op): Take context argument and
pass it down in obj_print_impl calls.
* lib.c (cobj_print_op, out_quasi_str): Likewise
(obj_print_impl): Likewise, and also pass to
COBJ print method.
(obj_print, obj_pprint): Pass null pointer
as context argument to obj_print_impl.
* regex.c (regex_print): Take context parameter and ignore it.
* socket.c (dgram_print): Likewise.
* stream.h (struct strm_ctx): New struct type.
(struct strm_base): New ctx member, pointer to struct
strm_ctx.
(stream_print_op): Add context parameter to declaration.
(get_set_ctx, get_ctx): Declared.
* stream.c (strm_base_init): Add null pointer to initializer.
(strm_base_cleanup): Add assertion against context pointer
being non-null: that indicates that some stream operation
installed a context pointer and neglected to restore it to
null before returning, which is bad because context will be
stack allocated.
(stream_print_op, stdio_stream_print, cat_stream_print): Take
context parameter and ignore it.
(get_set_ctx, get_ctx): New functions.
* struct.c (struct_type_print): Take context parameter and
ignore it.
(struct_inst_print): Take context parameter and pass
down to obj_print_impl.
|
|
|
|
|
|
|
|
| |
* stream.c (print_circle_s): New symbol variable.
(stream_init): Initialize print_circle_s as symbol
named *print-circle*; register as special var.
* stream.h (print_circle_s): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile, args.c, args.h, arith.c, arith.h, cadr.c, cadr.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, filter.c,
filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h,
jmp.S, lib.c, lib.h, lisplib.c, lisplib.h, match.c, match.h, parser.c,
parser.h, parser.l, parser.y, rand.c, rand.h, regex.c, regex.h,
share/txr/stdlib/awk.tl, share/txr/stdlib/build.tl,
share/txr/stdlib/cadr.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/hash.tl,
share/txr/stdlib/ifa.tl, share/txr/stdlib/path-test.tl,
share/txr/stdlib/place.tl, share/txr/stdlib/socket.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/termios.tl,
share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl,
share/txr/stdlib/with-resources.tl, share/txr/stdlib/with-stream.tl,
share/txr/stdlib/yield.tl, signal.c, signal.h, socket.c, socket.h,
stream.c, stream.h, struct.c, struct.h, sysif.c, sysif.h, syslog.c,
syslog.h, termios.c, termios.h, txr.1, txr.c, txr.h, unwind.c,
unwind.h, utf8.c, utf8.h: Revert to verbatim 2-Clause BSD.
|
|
|
|
|
|
|
|
|
| |
* stream.c (plp_regex): New static variable.
(pure_rel_path_p): New function.
(stream_init): gc-protect plp_regex.
Register pure-rel-path-p intrinsic.
* txr.1: Document pure-rel-path-p and slightly revise abs-path-p.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (struct strlist_in): New struct type.
(strlist_in_stream_mark, strlist_in_get_line,
strlist_in_get_char, strlist_in_unget_char,
strlist_in_get_prop, strlist_in_get_error_str):
New static functions.
(strlist_in_ops): New static struct.
(make_strlist_input_stream): New function.
(stream_init): Register make-strlist-input-stream
intrinsic.
* stream.h (make_strlist_input_stream): Declared.
* txr.1: Documented make-strlist-input-stream.
Call fill_stream_ops on new strlist_in_ops
struct to fill in common default stream operations.
|
|
|
|
|
|
|
|
|
| |
* socket.c (struct dgram_stream): New member, is_byte_oriented.
(dgram_get_char): In byte oriented mode, just get one byte
and convert to a character just like stdio_get_char: zero
goes to U+DC00, and 0x01-0xFF go to U+0001 to U+FFFF.
(dgram_get_prop, dgram_set_prop): Handle :byte-oriented
property for getting and setting the is_byte_oriented flag.
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (remove_path): New parameter, throw_on_error.
(stream_init): Update registratino of remove_path intrinsic.
* stream.h (remove_path): Declaration updated.
* txr.1: Updated remove-path documentation to describe
throw-on-error-p parameter.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* regex.c (read_until_match): New argument, include_match.
Three times repeated termination code refactored into block
reached by forward goto.
(regex_init): Registration of read-until-match updated.
* regex.h (read_until_match): Declaration updated.
* stream.c (struct record_adapter_base): New member,
include_match.
(record_adapter_get_line): Pass match to read_until_match
as new argument.
(record_adapater): New argument, include_match.
(stream_init): Update registration of record-adapter.
* stream.h (record_adapter): Declaration updated.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (sock_set_entries): Add auto-load entry
for open-socket.
* socket.c (open_socket): Change to static.
(sock_load_init): Register open-socket intrinsic
here rather than in stream.c.
* stream.c (stream_init): Remove registration of
open-socket intrinsic.
* stream.h (open_socket): Declaration removed.
|
|
|
|
|
|
|
|
|
| |
The open_sockfd function is only called within socket.c
* socket.c (open_sockfd): More function up and
change to static.
* stream.h (open_sockfd): Declaration removed.
|
|
|
|
|
|
|
|
| |
* stream.c (fmt): New function.
* stream.h (fmt): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is more to this patch than just more permissive
mode strings. Now if a socket can be opened with mode
"l2" for instance, and these options are effectively applied
to the socket-specific "r+b" default, not to "r".
* stream.c (parse_mode): New argument specifying a default
mode. The syntax is relaxed, allowing previously required
elements to be omitted.
(normalize_mode): New argument specifying a default mode.
Format mode is always called now, because an input string
is no longer necessarily a valid fopen string even in cases
when it doesn't specify any extensions.
(open_file, open_fileno, open_tail, open_command,
open_process): Use new normalize_mode argument for defaulting;
normalize_mode no longer defaults to "r".
* stream.h (stdio_mode_init_trivial): Macro removed.
(stdio_mode_init_blank, stdio_mode_init_r,
stdio_mode_init_rpb): New initializer macros.
(parse_mode, normalize_mode): Declarations updated.
* socket.c (sock_accept): In datagram socket case, use new
parse_mode argument for defaulting using stdio_mode_init_rpb,
rather than overriding a missing string with "r+b".
(open_sockfd): Likewise, and use new normalize_mode
argument similarly for defaulting the mode on a stream socket.
* txr.1: Documented mode string permissiveness.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* socket.c (struct dgram_stream): new rx_max member.
(make_dgram_sock_stream): New arguments: a struct stdio_mode,
and pointer to prototype dgram socket. If a size is specified
in the mode, then use that as rx_max. Otherwise if a prototype
socket is specified, use its rx_max as the new socket's rx_max.
Otherwise default on 65536.
(dgram_get_byte_callback): Use d->rx_max as the capture size,
rather than a hard-coded 65536.
(sock_accept): Use d->rx_max as capture size for datagram.
Parse the mode. Pass the parsed mode to make_dgram_sock_stream,
as well as the accepting socket, so it can set up the rx_max
for the new socket.
(open_sockfd): Parse the mode and pass to make_dgram_sock_stream.
* stream.c (parse_mode): Static function becomes extern.
* stream.h (parse_mode): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* streamn.c (struct stdio_handle): New member, buf.
(stdio_stream_destroy): Free the stdio_handle's buf.
(parse_mode): Handle digit character, converting it
to integer value stored in m.buforder.
(set_mode_props): Allocate a buffer and install into
FILE * stream if the mode specifies a buforder.
(make_stdio_stream_common): Initialize buffer to null.
* stream.h (struct stdio_mode): New signed bitfield
member, buforder.
(stdio_mode_init_trivial): Initialize buforder member
to -1.
* txr.1: Documented size order digit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (parse_mode): Recognize "l" and "u", and
set new flags.
(set_mode_props): More complicated behavior to
integrate the new options with the line mode defaulting
behavior of "i".
* stream.h (struct stdio_mode): New members unbuf
and linebuf. All members become bit fields of width 1.
(stdio_mode_init_trivial): Initializers for new members.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* socket.c (struct dgram_stream): New member, addr.
(make_dgram_sock_stream): Initialize addr to nil.
(dgram_print): Instead of printing the numeric fd, print the
stream description, obtained from the name_k property.
(dgram_mark): Mark the addr member.
(dgram_get_prop): Calculate a descriptive string from the
dgram stream state for the name_k property.
(dgram_set_prop): New static function.
(dgram_strm_ops): Name change to dgram-sock. Wire in
dgram_set_prop function.
(sock_bind): Set the addr_k property of the stream
to the local address that was just bound.
* stream.c (addr_k): New keyword symbol variable.
(stdio_handle): New member, addr.
(stdio_stream_print): Obtain descr by calling get_prop
method rather than directly from h->descr, in case it is
dynamically computed. Use ~a rather than ~s for incorporating
string properties into printed form, to eliminate quotes.
(stdio_stream_mark): Mark new addr member.
(sock_get_prop, sock_set_prop): New static functions.
(stdio_set_sock_peer): Invalidate h->descr by setting
it to nil.
(make_stdio_stream_common): Initialize h->addr to nil.
(make_sock_stream): Specify description as nil rather
than "socket".
(stream_init): Intern the addr keyword, and initialize
the addr_k variable.
Set the name of stdio_sock_ops to "stream-sock"
rather than leaving it inherited as "file-stream".
Wire in the sock_get_prop and sock_set_prop functions into
stdio_sock_ops.
* stream.h (addr_k): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* socket.c (struct dgram_stream): New struct.
(make_dgram_sock_stream, dgram_print, dgram_mark,
dgram_destroy, dgram_overflow, dgram_put_byte_callback,
dgram_put_string, dgram_put_char, dgram_put_byte,
dgram_get_byte_callback, dgram_get_char, dgram_get_byte,
dgram_unget_char, dgram_unget_byte, dgram_flush, dgram_close,
dgram_get_prop, dgram_get_fd, dgram_get_sock_family,
dgram_get_sock_type, dgram_get_sock_peer,
dgram_set_sock_peer, dgram_get_error, dgram_get_error_str,
dgram_clear_error): New static functions.
(dgram_strm_ops): New static structure.
(sock_listen): Check against datagram sockets which have
a peer; otherwise a no-op for datagram sockets.
(sock_accept): Special logic for dgram sockets.
(open_sockfd): Function moved here from stream.c, and
augmented to open dgram stream for dgram sockets.
(open_socket): Function moved here from stream.c.
(sock_load_init): Fill in some operations in dgram_strm_ops.
* stream.c (generic_get_line, make_sock_stream,
errno_to_string): Statics become external.
(open_sockfd, open_socket): Functions removed from here,
moved to socket.c.
* stream.h (generic_get_line, make_sock_stream,
errno_to_string): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (unimpl_get_fd, null_get_fd): New static functions.
(fill_stream_ops): Set up get_fd function pointer in
strm_ops.
(null_ops): Add null_get_fd.
(stdio_get_fd): New static function.
(stdio_ops, tail_ops, pipe_ops): Specify stdio_get_fd as get_fd
function.
(stream_fd): Rewritten as call to get_fd operation.
(dir_ops, string_in_ops, byte_in_ops, string_out_ops,
strlist_out_ops, cat_stream_ops): Specify null as get_fd
function, to be defaulted by fill_stream_ops.
(delegate_get_fd): New static function.
(record_adapter_ops): Specify delegate_get_fd as get_fd
function.
(stream_init): Change fileno intrinsic registration to point
to stream_fd function.
* stream.h (struct strm_ops): New member, get_fd.
(strm_ops_init): New macro parameter, get_fd.
* syslog.c (syslog_strm_ops): Specify null as get_fd
function.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (struct stdio_mode, stdio_mode_init_trivial):
Struct declaration and macro removed from here; moved into
stream.h.
(normalize_mode, set_mode_props): Static functions made
external.
* stream.h (struct stdio_mode, stdio_mode_init_trivial): Moved
here.
(normalize_mode, set_mode_props): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (unimpl_get_sock_family, unimpl_get_sock_type,
unimpl_get_sock_peer, unimpl_set_sock_peer): New static
functions.
(fill_stream_ops): Set new function pointers in struct
strm_ops to point to the unimpl_* functions.
(stdio_get_sock_family, stdio_get_sock_type,
stdio_get_sock_peer, stdio_set_sock_peer): New static
functions.
(stdio_sock_ops): New static structure.
(make_sock_stream): Use stdio_sock_ops for socket object.
(sock_family, sock_type, sock_peer, sock_set_peer): These API
functions now just call their corresponding virtuals.
(stream_init): Set up stdio_sock_ops as a copy of stdio_ops,
and then override the socket-specific virtuals from the
unimpl_* stubs to the stdio_get_sock_* and stdio_set_sock_*
functions.
* stream.h (struct strm_ops): New members, get_sock_family,
get_sock_type, get_sock_peer and set_sock_peer.
(strm_ops_init): Set new members to zero.
|
|
|
|
|
|
|
| |
* stream.c (make_sock_stream): External function becomes
static; it is not used outside of this source file.
* stream.h (make_sock_stream): Declaration removed.
|