| 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.
|
|
|
|
|
|
|
| |
* stream.c (run): Pass self to fds_swizzle.
* sysif.c (getpwuid_wrap): Declare self variable and pass
to c_num.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The noreturn macro is respelled to harmonize with the
upper-case INLINE and NOINLINE.
* lib.h (noreturn): Rename to NORETURN.
* arith.c (not_number, not_integer, invalid_ops, invalid_op):
Declaration updated.
* arith.c (do_mp_error): Likewise.
* eval.c (eval_error, no_bindable_error, dotted_form_error):
Likewise.
* eval.h (eval_error): Likewise.
* lib.c (unsup_obj, callerror, wrongargs): Likewise.
* match.c (sem_error): Likewise.
* stream.c (unimpl, unimpl_put_string, unimpl_put_char,
unimpl_put_byte, unimpl_get_line, unimpl_get_char,
unimpl_get_byte, unimpl_unget_char, unimpl_unget_byte,
unimpl_put_buf, unimpl_fill_buf, unimpl_seek, unimpl_truncate,
unimpl_get_sock_family, unimpl_get_sock_type,
unimpl_get_sock_peer, unimpl_set_sock_peer): Likewise.
* struct.c (no_such_struct, no_such_slot,
no_such_static_slot): Likewise.
* unwind.h (jmp_restore, uw_throw, uw_throwf, uw_errorf,
uw_errorfv, type_mismatch): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (UTF_DECL_OPENDIR): Macro defined, to enable
w_opendir declaration in utf8.h.
(w_opendir): Static function removed.
* sysif.c (UTF_DECL_OPENDIR): Macro defined.
(dir_s): Symbol defined unconditionally now, regardless of
HAVE_PWUID.
(dirent_s): New symbol.
(dirent_st): New static variable.
(struct dir): New struct type.
(opendir_free, opendir_mark opendir_wrap, readdir_wrap): New
static functions.
(opendir_ops): New static structure.
(sysif_init): Intern dirent symbol. Create dirent structure
type. Register opendir and readdir intrinsic functions.
Register variables dt-blk, dt-chr, dt-dir, dt-fifo, dt-lnk,
dt-reg, dt-sock and dt-unknown.
* utf8.c (UTF8_DECL_OPENDIR): Macro defined.
(w_opendir): Function moved here from stream.c, and turned
external.
* utf8.h (w_opendir): Declared, conditionally on
UTF8_DECL_OPENDIR being defined, so that most modules that
include utf8.h don't have to include <dirent.h>.
* txr.1: Documented.
diff --git a/sysif.c b/sysif.c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The c_num and c_unum functions now take a self argument for
identifying the calling function. This requires changes in a
large number of places.
In a few places, additional functions acquire a self
argument. The ffi module has the most extensive example of
this.
Some functions mention their name in a larger string, or have
scattered literals giving their name; with the introduction of
the self local variable, these are replaced by references to
self.
In the following changelog, the notation TS stands for "take
self argument", meaning that the functions acquires a new "val
self" argument. The notation DS means "define self": the functions
in question defines a self variable, which they pass down.
The notation PS means that the functions pass down an existing
self variable to functions that now require it.
* args.h (args_count): TS.
* arith.c (c_unum, c_num): TS.
(toint, exptv): DS.
* buf.c (buf_check_len, buf_check_alloc_size, buf_check_index,
buf_do_set_len, replace_buf, buf_put_buf, buf_put_i8,
buf_put_u8, buf_put_char, buf_put_uchar, buf_get_bytes,
buf_get_i8, buf_get_u8, buf_get_cptr,
buf_strm_get_byte_callback, buf_strm_unget_byte, buf_swap32,
str_buf, buf_int, buf_uint, int_buf, uint_buf): PS.
(make_duplicate_buf, buf_shrink, sub_buf, buf_print,
buf_pprint): DS.
* chskum.c (sha256_stream_impl, sha256_buf, crc32_buf,
md5_stream_impl, md5_buf): TS.
(chksum_ensure_buf, sha256_stream, sha256, sha256_hash,
md5_stream, md5, md5_hash): PS.
(crc32_stream): DS.
* combi.c (perm_while_fun, perm_gen_fun_common,
perm_str_gen_fun, rperm_gen_fun, comb_vec_gen_fun,
comb_str_gen_fun, rcomb_vec_gen_fun, rcomb_str_gen_fun): DS.
* diff.c (dbg_clear, dbg_set, dbg_restore): DS.
* eval.c (do_eval, gather_free_refs, maprodv, maprendv,
maprodo, do_args_apf, do_args_ipf): DS.
(op_dwim, me_op, map_common): PS.
(prod_common): TS.
* ffi.c (struct txr_ffi_type): release member TS.
(make_ffi_type_pointer): PS and release argument TS.
(ffi_varray_dynsize, ffi_array_in, ffi_array_put_common,
ffi_array_get_common, ffi_varray_in, ffi_varray_null_term): PS.
(ffi_simple_release, ffi_ptr_in_release, ffi_struct_release,
ffi_wchar_array_get, ffi_array_release_common,
ffi_array_release, ffi_varray_release): TS.
(ffi_float_put, double_put, ffi_be_i16_put, ffi_be_u16_put,
ffi_le_i16_put, ffi_le_u16_put, ffi_be_i32_put, ffi_be_u32_put,
ffi_le_i32_put, ffi_sbit_put, ffi_ubit_put, ffi_buf_d_put,
make_ffi_type_array, make_ffi_type_enum, ffi_type_compile,
make_ffi_type_desc, ffi_make_call_desc, ffi_call_wrap,
ffi_closure_dispatch_save, ffi_put_into, ffi_in, ffi_get,
ffi_put, carray_set_length, carray_blank, carray_buf,
carray_buf_sync, carray_cptr, carray_refset, carray_sub,
carray_replace, carray_uint, carray_int): PS.
(carray_vec, carray_list): DS.
* filter.c (url_encode, url_decode, base64_stream_enc_impl): DS.
* ftw.c (ftw_callback, ftw_wrap): DS.
* gc.c (mark_obj, gc_set_delta): DS.
* glob.c (glob_wrap): DS.
* hash.c (equal_hash, eql_hash, eq_hash, do_make_hash,
hash_equal, set_hash_traversal_limit, gen_hash_seed): DS.
* itypes.c (c_i8, c_u8, c_i16, c_u16, c_i32, c_u32, c_i64,
c_u64, c_short, c_ushort, c_int, c_uint, c_long, c_ulong): PS.
* lib.c (seq_iter_rewind): TS and becomes internal.
(seq_iter_init_with_info, seq_setpos, replace_str, less,
replace_vec, diff, isec, obj_print_impl): PS.
(nthcdr, equal, mkstring, mkustring, upcase_str, downcase_str,
search_str, sub_str, cat_str, scat2, scat3, fmt_join,
split_str_keep, split_str_set, trim_str, int_str, chr_int,
chr_str, chr_str_set, vector, vecref, vecref_l, list_vec,
copy_vec, sub_vec, cat_vec, lazy_str_put, lazy_str_gt,
length_str_ge, length_str_lt, length_str_le, cptr_size_hint,
cptr_int, out_lazy_str, out_quasi_str, time_string_local_time,
time_string_utc, time_fields_local_time, time_fields_utc,
time_struct_local, time_struct_utc, make_time, time_meth,
time_parse_meth): DS.
(init_str, cat_str_init, cat_str_measure, cat_str_append,
vscat, time_fields_to_tm, time_struct_to_tm, make_time_impl): TS.
* lib.h (seq_iter_rewind): Declaration removed.
(c_num, c_unum, init_str): Declarations updated.
* match.c (LOG_MISMATCH, LOG_MATCH): PS.
(h_skip, h_coll, do_output_line, do_output, v_skip, v_fuzz,
v_collect): DS.
* parser.c (parser, circ_backpatch, report_security_problem,
hist_save, repl, lino_fileno, lino_getch, lineno_getl,
lineno_gets, lineno_open): DS.
(parser_set_lineno, lisp_parse_impl): PS.
* parser.l (YY_INPUT): PS.
* rand.c (make_random_state): PS.
* regex.c (print_rec): DS.
(search_regex): PS.
* signal.c (kill_wrap, raise_wrap, get_sig_handler,
getitimer_wrap, setitimer_wrap): DS.
* socket.c (addrinfo_in, sockaddr_pack, fd_timeout,
to_connect, open_sockfd, sock_mark_connected,
sock_timeout): TS.
(getaddrinfo_wrap, dgram_set_sock_peer, sock_bind,
sock_connect, sock_listen, sock_accept, sock_shutdown,
sock_send_timeout, sock_recv_timeout, socketpair_wrap): DS.
* stream.c (generic_fill_buf, errno_to_string, stdio_truncate,
string_out_put_string, open_fileno, open_command, base_name,
dir-name): DS.
(unget_byte, put_buf, fill_buf, fill_buf_adjust,
get_line_as_buf, formatv, put_byte, test_set_indent_mode,
test_neq_set_indent_mode, set_indent_mode, set_indent,
inc_indent, set_max_length, set_max_depth, open_subprocess, run ): PS.
(fds_subst, fds_swizzle): TS.
* struct.c (make_struct_type, super, umethod_args_fun): PS.
(method_args_fun): DS.
* strudel.c (strudel_put_buf, strudel_fill_buf): DS.
* sysif.c (errno_wrap, exit_wrap, usleep_wrap, mkdir_wrap,
ensure_dir, makedev_wrap, minor_wrap, major_wrap, mknod_wrap,
mkfifo_wrap, wait_wrap, wifexited, wexitstatus, wifsignaled,
wtermsig, wcoredump, wifstopped, wstopsig, wifcontinued,
dup_wrap, close_wrap, exit_star_wrap, umask_wrap, setuid_wrap,
seteuid_wrap, setgid_wrap, setegid_wrap,
simulate_setuid_setgid, getpwuid_wrap, fnmatch_wrap,
dlopen_wrap): DS.
(chmod_wrap, do_chown, flock_pack, do_utimes, poll_wrap,
setgroups_wrap, setresuid_wrap, setresgid_wrap, getgrgid_wrap): PS.
(c_time): TS.
* sysif.h (c_time): Declaration updated.
* syslog.c (openlog_wrap, syslog_wrap): DS.
* termios.c (termios_pack): TS.
(tcgetattr_wrap, tcsetattr_wrap, tcsendbreak_wrap,
tcdrain_wrap, tcflush_wrap, tcflow_rap, encode_speeds,
decode_speeds): DS.
* txr.c (compato, array_dim, gc_delta): DS.
* unwind.c (uw_find_frames_by_mask): DS.
* vm.c (vm_make_desc): PS.
(vm_make_closure, vm_swtch): DS.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
All string_utf8(strerror(x)) calls are replaced with
errno_to_str(x).
* sysif.c (errno_to_str): New function.
(strerror_wrap): Now implemented via call to errno_to_str.
(mkdir_wrap, ensure_dir, chdir_wrap, getcwd_wrap, rmdir_wrap,
mknod_wrap, mkfifo_wrap, chmod_wrap, do_chown, symlink_wrap,
link_wrap, readlink_wrap, close_wrap, exec_wrap, stat_impl,
do_utimes, pipe_wrap, poll_wrap, getgroups_wrap, setuid_wrap,
seteuid_wrap, setgid_wrap, setegid_wrap, setgroups_wrap,
getresuid_wrap, getresgid_wrap, setresuid_wrap,
setresgid_wrap, crypt_wrap, uname_wrap): Use errno_to_str.
* sysif.h (errno_to_str): Declared.
* ftw.c (ftw_wrap): Use errno_to_str.
* socket.c (dgram_get_byte_callback, dgram_flush, sock_bind,
open_sockfd, sock_connect, sock_listen, sock_accept,
sock_shutdown, sock_timeout, socketpair_wrap): Likewise.
* stream.c (errno_to_string): Likewise, and don't handle
zero case any more; pass down to errno_to_str.
(stdio_close, pipe_close open_directory, open_file,
open_fileno, open_tail, fds_subst, open_command,
open_subprocess, run, remove_path, rename_path): Use
errno_to_str.
* termios.c (tcgetattr_wrap, tcsetattr_wrap, tcsetattr_wrap,
tcsendbreak_wrap, tcdrain_wrap, tcflush_wrap, tcflow_wrap):
Likewise.
diff --git a/termios.c b/termios.c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: provide LONGLONG_TYPE and INTPTR_TYPE macros in
config.h that expand to a string literal capturing the
original tokens of the type that was probed.
* stream.c (struct fmt): Removed size member, replaced with
type string. We can match format strings to the textual type,
which will work even if we cannot compile that type. So that
is to say, for instance the "%I64d" entry in the table is
associated with "int64", whereas an expression like sizeof
(int64) won't compile where that type doesn't exist.
(fmt_tab): Replace sizes with type names. Also fix an issue:
%llx was replicated in three rows of the table.
(detect_format_string): Determine the textual type of cnum. It
is a typedef for intptr_t, and the new INPTR_TYPE macro gives
the tokens that were used to typedef intptr_t. If
INTPTR_TYPE happens to be "longlong_t", we use LONGLONG_TYPE
in its place. Then using the determined type, we can search
the table for an appropriate entry: one which matches the type
and whose conversion specifier works. Also, we now test all
four conversion specifiers rather than assuming that if the
decimal one is okay, the others work. Plus, if a working
format string is not found, we now abort.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Querying the :fd stream property is equivalent to calling the
stream-fd function. Streams have a C virtual function get_fd,
so implementing :fd in their getprop functions is redundant
functionality. The stream-getprop function can test for
:fd and call stream-fd, so the stream implementations don't
have to deal with the :fd property.
Also, there are still places in the code base that are using
stream_getprop to get the file descriptor, instead of calling
stream_fd.
If we fix all this, then fd_k remains referenced only in
a very small number of places.
* socket.c (dgram_get_prop): Don't handle :fd any more.
* stream.c (unimpl_get_fd): Static function removed.
(fill_stream_ops): Default the get_fd function to null_get_fd
instead of unimpl_get_fd, so it doesn't throw.
Even a stdio stream don't throw; when the file is closed,
it returns nil.
(stdio_get_prop): Don't handle :fd any more.
(stream_get_prop): Handle :fd here. If the stream has a get_fd
function that isn't null_get_fd, then call it. Only if the
stream doesn't have a get_fd function, fall back on its
get_prop function.
* sysif.c (mkdir_wrap, poll_wrap, simulate_setuid_setgid):
Call stream_fd instead of stream_get_prop.
|
|
|
|
|
|
|
|
|
|
| |
Time for some spring cleaning.
* args.c, arith.c, buf.c, cadr.c, chksum.c, debug.c, ftw.c,
gc.c, gencadr.txr, glob.c, hash.c, lisplib.c, match.c,
parser.c, parser.l, parser.y, rand.c, signal.c, stream.c,
strudel.c, syslog.c, tree.c, unwind.c, utf8.c, vm.c: Numerous
unnecessary #include directives removed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The c_unum and unum functions are fairly often needed
and and are closely related to c_num and num, which have
always been declared in lib.h even though they live in
arith.c. Files not doing arithmetic are including "arith.h"
just for the sake of c_num or unum.
* arith.h (c_unum, unum): Declarations removed.
* lib.h (c_unum, unum): Declarations moved here.
* chksum.c, debug.c, stream.c, strudel.c, sysif.c, vm.c:
These files no longer require #include "arith.h" as a result,
which is therefore removed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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): Add O_APPEND flag if
m.append is set.
(do_parse_mode): Set m.notrunc flag for append mode, so
O_TRUNC won't be added in w_fopen_mode.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With this patch, if open-file blocks (for instance on a FIFO
or device), it is interruptible. In the listener, the
operation can be aborted with Ctrl-C now.
* stream.c (w_fopen_mode): If we HAVE_FCNTL, then handle all
file opening via open + fdopen, rather than fopen. On
platforms where we use fopen, interruptibility won't work.
The fopen function cannot be abandoned via an exception thrown
from a signal handler because it performs memory allocation.
Because we need a temporary UTF-8 string to do the open,
which might be abandoned by a signal, let's move the string to
the stack via alloca, and free the original, so we don't have
to set up unwinding to free it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
| |
* stream.c (w_fopen_mode): When the "m" mode is present such
that we resort to a combination of POSIX open and fdopen,
we must use the 0666 mode for open, not 0777. This will
create a file with execute permissions, if the umask
doesn't block it. It went unnoticed because umask is
usually 022.
|
|
|
|
|
|
|
| |
* stream.c (stdio_maybe_error): We want to say "error
whatever-ing #<stream ....>": the action has to come first,
and from the format specifiers being ~a ~s, that was clearly
the intent.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the third round of an effort to enable GCC's -Wextra
option. Instances of signed/unsigned mismatch between
the branches of ternary conditionals are addressed.
* ffi.c (pad_retval): Add cast into the consequent of
the conditional so it yields size_t, like the alternative.
* lib.c (split_str_keep): Likewise.
(vector): Cast -1 to ucnum so it has the same type as the
alloc_plus opposite to it.
* parser.c (lino_getch): Add a cast to wint_t to match
return value and opposite WEOF operand.
* stream.c (generic_get_line): Likewise.
* sysif.c (c_time): Convert both consequent and alternative
to time_t to silence warning.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the first round of an effort to enable GCC's -Wextra
option. All function parameters that are unused an that we
cannot eliminate are treated with a cast to void in the
function body.
* args.c (args_key_check_store): Cast unused param to void.
* combi.c (perm_list_gen_fill): Likewise.
* eval.c (op_error, op_meta_error, op_quote op_qquote_error,
op_unquote_error, op_load_time_lit, me_each, me_for,
me_quasilist, me_flet_labels, hash_min_max, me_ignerr,
me_whilet, me_iflet_whenlet, me_dotimes, me_mlet,
me_load_time, me_load_for): Likewise.
* ffi.c (ffi_void_put, ffi_fixed_dynsize, *ffi_fixed_alloc,
ffi_noop_free, ffi_void_get, ffi_simple_release, ffi_i8_put,
ffi_i8_get, ffi_u8_put, ffi_u8_get, ffi_i16_put, ffi_i16_get,
ffi_u16_put, ffi_u16_get, ffi_i32_put, ffi_i32_get,
ffi_u32_put, ffi_u32_get, ffi_i64_put, ffi_i64_get,
ffi_u64_put, ffi_u64_get, ffi_char_put, ffi_char_get,
ffi_uchar_put, ffi_uchar_get, ffi_bchar_get, ffi_short_put,
ffi_short_get, ffi_ushort_put, ffi_ushort_get, ffi_int_put,
ffi_int_get, ffi_uint_put, ffi_uint_get, ffi_long_put,
ffi_long_get, ffi_ulong_put, ffi_ulong_get, ffi_float_put,
ffi_float_get, ffi_double_put, ffi_double_get, ffi_val_put,
ffi_val_get, ffi_be_i16_put, ffi_be_i16_get, ffi_be_u16_put,
ffi_be_u16_get, ffi_le_i16_put, ffi_le_i16_get,
ffi_le_u16_put, ffi_le_u16_get, ffi_be_i32_put,
ffi_be_i32_get, ffi_be_u32_put, ffi_be_u32_get,
ffi_le_i32_put, ffi_le_i32_get, ffi_le_u32_put,
ffi_le_u32_get, ffi_be_i64_put, ffi_be_i64_get,
ffi_be_u64_put, ffi_be_u64_get, ffi_le_i64_put,
ffi_le_i64_get, ffi_le_u64_put, ffi_le_u64_get, ffi_wchar_put,
ffi_wchar_get, ffi_sbit_get, ffi_ubit_get, ffi_cptr_get,
ffi_str_in, ffi_str_put, ffi_str_get, ffi_str_d_get,
ffi_wstr_in, ffi_wstr_get, ffi_wstr_put, ffi_wstr_d_get,
ffi_bstr_in, ffi_bstr_put, ffi_bstr_get, ffi_bstr_d_get,
ffi_buf_in, ffi_buf_put, ffi_buf_get, ffi_buf_d_in,
ffi_buf_d_put, ffi_buf_d_get, ffi_closure_put, ffi_ptr_in_in,
ffi_ptr_in_d_in, ffi_ptr_in_out, ffi_ptr_out_in,
ffi_ptr_out_out, ffi_ptr_out_null_put, ffi_ptr_out_s_in,
ffi_flex_struct_in, ffi_carray_get, ffi_union_get,
make_ffi_type_builtin, make_ffi_type_array,
ffi_closure_dispatch, ffi_closure_dispatch_safe): Likewise.
* gc.c (cobj_destroy_stub_op, cobj_destroy_free_op, cobj_mark_op): Likewise.
* lib.c (seq_iter_get_nil, seq_iter_peek_nil): Likewise.
* linenoise/linenoise.c (sigwinch_handler): Likewise.
* parser.c (repl_intr, read_eval_ret_last, repl_warning,
is_balanced_line): Likewise.
* parser.y (yydebug_onoff): Likewise.
* socket.c (dgram_close): Likewise.
* stream.c (unimpl_put_string, unimpl_put_char,
unimpl_put_byte, unimpl_unget_char, unimpl_unget_byte,
unimpl_put_buf, unimpl_fill_buf, unimpl_seek, unimpl_truncate,
unimpl_set_sock_peer, null_put_string, null_put_char,
null_put_byte, null_get_line, null_get_char, null_get_byte,
null_close, null_flush, null_seek, null_set_prop,
null_get_error, null_get_error_str, null_clear_error,
null_get_fd, dir_close): Likewise.
* struct.c (struct_type_print): Likewise.
* unwind.c (me_defex): Likewise.
|
|
|
|
|
|
|
| |
TXR 228, which introduced open-subprocess, broke open-process.
* stream.c (open_process): Pass args correctly as the fourth
argument of open_subprocess, rather than the third.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The various curry_xx_yy functions perform partial application,
not currying. The curry prefix is being renamed to pa
(partially apply).
* lib.c (remq_lazy, remql_lazy, remqual_lazy, tree_Find):
Updated.
(do_curry_12_1, do_curry_12_1_v, do_curry_12_2,
do_curry_123_1, do_curry_123_23, do_curry_123_2,
do_curry_123_3, do_curry_1234_1, do_curry_1234_34):
Renamed to do_pa_12_1, do_pa_12_1_v, do_pa_12_2, do_pa_123_1,
do_pa_123_23, do_pa_123_2, do_pa_123_3, do_pa_1234_1,
do_pa_1234_34.
(curry_12_1, curry_12_1_v, curry_12_2, curry_123_1,
curry_123_23, curry_123_2, curry_123_3, curry_1234_1,
curry_1234_34): Renamed to pa_12_1, pa_12_1_v, pa_12_2,
pa_123_1, pa_123_23, pa_123_2, pa_123_3, pa_1234_1,
pa_1234_34.
(transposev, do_juxt): Updated.
* lib.h: Declarations renamed.
* eval.c (subst_vars, qquote_init, expand_catch, weavev):
Updated.
* filter.c (get_filter, build_filter_from_list,
filter_string_tree, filter_init): Updated.
* match.c (tx_subst_vars, do_txeval, v_freeform, v_bind,
v_throw, v_deffilter, v_assert, h_assert): Updated.
* parser.y (gather_clause): Updated.
* regex.c (regex_range_full_fun, regex_range_left_fun,
regex_range_right_fun, regex_range_search_fun): Updated.
* stream.c (open_files, open_files_star): Updated.
* txr.c (txr_main): Updated.
* unwind.c (me_defex): Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We revive the dead _wspawnvp code that was used on MinGW, a
platform that has not been supported for years, adapting it
for Cygwin.
* configure: Correct the _wspawnlp test; it should have been
testing for _wspawnvp function, which is what is is actually
used by the matching code. Moreover, the broken test was
calling _wspawnlp with _wspawnvp style arguments. Anyway, this
is moot because we will never detect this function in the
foreseeable future. More importantly, adding a test for
spawnvp, which exists on Cygwin.
* stream.c: Include the <process.h> header if HAVE_WSPAWN or
HAVE_SPAWN. This was missing before; how did the _wspawnvp
call ever compile?
(w_spawnvp): New static function.
(run): spawn version now calls either _wspawwnvp or w_spawnvp
if that is not available. We test for HAVE_WSPAWN or
HAVE_SPAWN first, before HAVE_FORK_STUFF, so that we use the
spawn function preferentially. On Cygwin, we have the fork
stuff.
|
|
|
|
|
|
|
| |
* stream.c (w_fopen_mode): Fix diagnostic to refer to "m" mode
instead of "o" mode, adjusting the wording at the same time.
This is only compiled on platforms without HAVE_FCNTL;
basically nothing that TXR is commonly built for.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
* stream.c (stdio_fill_buf): In the case of EOF, we must not
return zero, but pos. Also, since pos and nread are cnum,
we should use num to convert their sum to val. Converting to
unum doesn't do anything for the overflow situation.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The open-files and open-files* functions are missing a mode
string argument, which makes it impossible to, say, open all
of the files in "rb" mode on a platform where that matters.
* stream.c (open_files, open_files_star): Take mode as a third
optional parameter. If it is present, then pass it to
open_file.
* txr.1: Document mode string parameter for the two functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (open_subprocess): new function, formed by adding
fun argument to open_process. Since the program name can be
nil now, in which case argv is not allocated, the code must
be careful not to access argv if it is null.
(open_process): Reduced to trivial wrapper around
open_subprocess.
(stream_init): open-subprocess intrinsic registered.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a regression introduce in the 2019-06-09 commit
4f33b169dc547b7f9af6f2f1c173d36fc4d62fe8 "Adding fcntl
interface." which changed HAVE_FCNTL_H to HAVE_FCNTL
in the configure script, without making the same change
in stream.c.
* stream.c: Replace HAVE_FCNTL_H with the correct
HAVE_FCNTL, so that we're once again actually including
the <fcntl.h> header now, and setting the close-on-exec
flag on the pipe in open-process.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: In several config tests, test HAVE_SUPERLONG_T,
HAVE_LONGLONG_T and HAVE_SYS_WAIT with #if.
* lib.c: Test HAVE_GETENVIRONMENTSTRINGS with #if.
* lib.h: Test HAVE_DOUBLE_INTPTR_T with #if.
* mpi/mpi.c: Likewise.
* mpi/mpi.h: Likewise.
* socket.c: Test HAVE_GETADDRINFO with #if in three places.
* stream.c: Test HAVE_SYS_WAIT and HAVE_SOCKETS with #if.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
* stream.c (stream_init): Register make-byte-input-stream
intrinsic.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Objects should almost always be printed as ~s.
If a bad object is printed as ~a, junk could result
on the terminal if it's a buffer, for instance.
* stream.c (stdio_maybe_read_error, stdio_maybe_error,
stdio_close, pipe_close, parse_mode, normalize_mode,
normalize_mode_no_bin, cat_unget_byte, cat_unget_char,
unget_byte, open_directory, open_file, open_tail,
open_command, open_process, run, remove_path, rename_path):
Revise conversion specifiers in error message formatting.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Several new more specific exception types are derived from
file-error and used. Error handlers can distinguish unexpected
non-existence, unexpected existence and permission errors
from each other and other errors.
* lib.c (path_not_found_s, path_exists_s, path_permission_s):
New symbol variables.
(obj_init): New variables initialized.
* lib.h (path_not_found_s, path_exists_s, path_permission_s):
Declared.
* parser.c (open_txr_file): Use new errno_to_file_error
function to convert errno to exception symbol.
* socket.c (open_sockfd): Likewise.
* stream.c (open_directory, open_file, open_fileno,
open_command, open_process, run, remove_path, rename_path):
Likewise, and process-error is used in open_process and run
instead of file-error for problems related to creating the
process.
* sysif.c (errno_to_file_error): New function.
(mkdir_wrap, ensure_dir, chdir_wrap, getcwd_wrap, mknod_wrap,
chmod_wrap, symlink_wrap, link_wrap, readlink_wrap, stat_impl,
umask_wrap, ): Use
errno_to_file_error to convert errno to exception symbol.
(exec_wrap): Use process-error instead of file-error.
* sysif.c (errno_to_file_error): Declared.
* unwind.c (uw_init): Register path-not-found, path-exists and
path-permission as subtypes of file-error.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (stdio_seek): Handle new-style Boolean return from
stdio_fseek.
* sysif.c (stdio_fseek): Return an int indication that is 1
for success, 0 for failure. There was a mistaken assumption
here that fseeko returns the file offset, and the return value
in the fseek case was mistakenly harmonized, using a wasteful
call to stdio_ftell. The only call to this function relies
only on a Boolean success/fail indication.
* sysif.h (stdio_fseek): Declaration updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: Instead of generating a definition of ALLOCA_H,
generate the variable HAVE_ALLOCA_<name> with a value of 1,
where <name> is one of stdlib, alloca or malloc.
* alloca.h: New header.
* args.c, eval.c, ffi.c ffi.c, ftw.c, hash.c, lib.c, match.c,
parser.c, parser.y, regex.c, socket.c, stream.c, struct.c,
sysif.c, syslog.c, termios.c, unwind.c, vm.c: Include
"alloca.h" instead of ALLOCA_H.
|
|
|
|
|
|
|
|
|
|
| |
* hash.c: Don't include "cadr.h".
* stream.c: Don't include "struct.h".
* strudel.c: No <syslog.h>, ALLOCA_H, "args.h" or "utf8.h".
* vm.c: No "hash.h".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In this patch, the cobj_handle, cobj_ops and variants of
gethash get an additional argument to identify the caller.
Many functions are updated to pass this down.
* buf.c (buf_strm): Pass self name to cobj_handle.
* eval.c (env_fbind, env_vbind, rt_defvarl, me_case): Pass
self name to gethash_c or gethash_e.
(load): Pass self name to read_eval_stream and
read_compiled_file.
(reg_symacro): Pass situation-identifying string to gethash_c.
* ffi.c (ffi_type_struct_checked, ffi_closure_struct_checked,
ffi_call_desc_checked, uni_struct_checked):
Take self name parameter, and pass down to cobj_handle.
(ffi_get_type, ffi_get_lisp_type): Take self name and pass
down to ffi_type_struct_checked.
(union_get_ptr): Take self name and pass to
uni_struct_checked.
(ffi_union_in, ffi_union_put): Pass self name to union_get_ptr.
(ffi_type_compile): Pass self name to ffi_get_lisp_type.
(ffi_make_call_desc): Pass self name to
ffi_type_struct_checked, ffi_get_type and
ffi_call_desc_checked.
(ffi_make_closure): Pass self name to ffi_call_desc_checked.
(ffi_closure_get_fptr): Take self name, pass to
ffi_closure_struct_checked.
(ffi_typedef, ffi_size, ffi_alignof, ffi_offsetof,
ffi_arraysize, ffi_elemsize, ffi_elemtype, ffi_put_into,
ffi_put, ffi_in, ffi_get, ffi_out, make_carray): Pass self
name to ffi_closure_struct_checked.
(carray_struct_checked): Take self name, pass to cobj_handle.
(carray_set_length, carray_dup, carray_own, carray_free,
carray_type, length_carray, copy_carray, carray_ptr,
buf_carray, vec_carray, list_carray, carray_ref,
carray_refset, carray_sub, carray_replace, carray_get_common,
carray_put_common, unum_carray, num_carray, put_carray,
fill_carray): Pass self name to carray_struct_checked.
(carray_blank, carray_buf, carray_cptr): Pass self name
ffi_type_struct_checked.
(carray_pun): Pass self name to carray_struct_checked and
ffi_type_struct_checked.
(make_union): Pass self name to ffi_type_struct_checked.
(union_members, union_get, union_put, union_in, union_out):
Pass self name to uni_struct_checked.
(make_zstruct, zero_fill, put_obj, get_obj, fill_obj): Pass
self-name to ffi_type_struct_checked.
* ffi.h (ffi_closure_get_fptr, union_get_ptr): Declarations
updated.
* filter.c (trie_add): Pass self-name to gethash_l.
* hash.c (make_similar_hash, copy_hash, hash_count,
get_hash_userdata, set_hash_userdata, hash_begin, hash_next,
hash_uni, hash_diff, hash_isec): Pass self name
to cobj_handle.
(gethash_c, gethash_e): Take self name parameter and pass down
to cobj_handle.
(gethash_f): Take self parameter and pass down to gethash_e.
(gethash, inhash, gethash_n, sethash, pushhash, remhash,
clearhash, hash_update_1): Pass self name to gethash_e or gethash_c.
* hash.h (gethash_c, gethash_e, gethash_f): Declarations
updated.
(gethash_l): Take self name, and pass down to gethash_c.
* lib.c (class_check): Take self name parameter and use in
type mismatch diagnostic.
(use_sym, unuse_sym, symbol_needs_prefix, find_symbol,
intern, unintern, intern_fallback, unique, in, sel,
obj_print_impl, populate_obj_hash, obj_hash_merge): Pass self
name to gethash_f or gethash_l.
(symbol_visible, obj_init): Pass situation-identifying string
to gethash_e.
(cobj_handle, cobj_ops): Take self name parameter and pass
down to class_check.
* lib.h (class_check, cobj_handle, cobj_ops): Declarations
updated.
* match.c (v_load): Pass self name to read_compiled_file and
read_eval_stream.
* parser.c (get_parser_impl): Take self name and pass to
cobj_handle.
(ensure_parser): Pass situation-identifying string to
gethash_c.
(parser_circ_def): Pass self-name to gethash_c.
(lisp_parser_impl): Pass self name to get_parser_impl and
class_check.
(lisp_parse, nread, iread): Pass self-name to lisp_parser_impl.
(read_file_common): Take self name parameter and pass down to
get_parser_impl.
(read_eval_stream, read_compiled_file): Take self name and
pass down to read_file_common.
(load_rcfile): Pass situation-identifying string to
read_eval_streem.
(get_visible_syms): Pass situation-identifying string to
gethash_c.
(parser_errors, parser_eof): Pass self name to cobj_handle.
* parser.h (read_eval_stream, read_compiled_file):
Declarations updated.
* parser.y (rlset): Pass self name to gethash_c.
* rand.c (make_random_state, random_state_get_vec,l
random_fixnum, random_float): Pass self name to cobj_handle.
* regex.c (regex_source, regex_print, regex_run): Pass
self-name to cobj_handle.
(regex_machine_init): Take self name param and pass to
cobj_handle.
(search_regex, match_regex, match_regex_right,
regex_prefix_match, read_until_match): Pass self-name to
regex_machine_init.
* stream.c (stdio_get_fd): Pass self name to cobj_handle.
(generic_get_line): Get COBJ operations via unsafe, diret
object access rather than cobj_ops.
(set_mode_props): Get object handle via unsafe, direct object
access.
(stream_fd, sock_family, sock_type, sock_peer, set_sock_peer,
get_string_from_stream, get_list_from_stream, stream_set_prop,
stream_get_prop, close_stream, get_error, get_error_str,
clear_error, get_line, get_char, get_byte, unget_char,
unget_byte, put_buf, fill_buf, put_string, put_char, put_byte,
flush_stream, seek_stream, truncate_stream, get_indent_mode,
test_set_indent_mode, set_indent_mode, get_indent, set_indent,
inc_indent, width_check, force_break, get_set_ctx, get_ctx):
Pass self name to cobj_ops.
(make_delegate_stream): Take self name parameter, pass down to
cobj_ops.
(record_adapter): Pass self name down to make_delegate_stream.
(format): Pass self name to class_check.
* struct.c (stype_handle): Pass self name to cobj_handle.
(make_struct_type): Pass self name to class_check.
* txr.c (read_eval_stream_noerr): Take self name parameter,
pass to read_eval_stream.
(txr_main): Pass istuation-identifying string to
read_compiled_file and read_eval_stream_noerr.
* unwind.c (revive_cont): Pass self-name to cobj_handle.
* vm.c (vm_desc_struct): Take self name parameter, pass to
cobj_handle.
(vm_desc_nlevels, vm_desc_nregs, vm_desc_bytecode,
vm_desc_datavec, vm_desc_symvec, vm_execute_toplevel,
vm_execute_closure, vm_closure_entry): Pass self name to
vm_desc_struct.
(vm_closure_struct): Take self name parameter, pass to
cobj_handle.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (make_ffi_type_enum): Use ~a for function name rather
than ~s because it's a string which is quoted under ~s.
* lib.c (chk_xalloc, string_extend, find_symbol,
intern_fallback): Likewise.
* stream.c (open_process, run): Likewise.
* sysif.c (exec_wrap, setgroups_wrap, dlclose_wrap): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
More streamlined code, better identification of functions.
* arith.c (not_number, not_integer, invalid_ops, invalid_op,
divzero): New static functions.
(num_to_buffer, bugnum_len, plus, minus, neg, abso, signum,
mul, trunc1, mod, floordiv, round1, roundiv, divi, zerop,
plusp, minusp, evenp, oddp, gt, lt, ge, le, numeq, expt,
exptmod, floorf, ceili, sine, cosi, tang, asine, acosi, atang,
loga, logten, logtwo, expo, sqroot, int_flo, flo_int,
cum_norm_dist, inv_cum_norm): Establish function's Lisp name as
self variable. Use new static functions for reporting common
errors. Pass function name to new argument of c_flo function.
* buf.c (buf_put_float, buf_put_double): Pass function's Lisp
name to c_flo function.
* ffi.c (ffi_float_put, ffi_double_put): Likewise.
* lib.c (c_flo): Takes new argument, name of calling function.
* lib.h (c_flo): Declaration updated.
* stream.c (formatv): Pass function name to c_flo.
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (stream_init): When stdin is a TTY, we make it
unbuffered. This affects the parenthesis matching and
incomplete line warning flash in the listener, in the
following way. The listener uses the poll function to execute
delays which is canceled by the presence of TTY input. This
logic breaks when data is pasted into the terminal, because
the stdin stream buffers the input.
|