| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (struct stdio_handle): New member, peer.
(stdio_stream_mark): Mark the new member.
(sock_peer, sock_set_peer): New functions.
(stream_init): Registered sock-peer intrinsic.
* stream.h (sock_peer, sock_set_peer): Declared.
* socket.c (sock_connect): If the connect is successful,
then store the address into the stream as the peer.
|
|
|
|
|
| |
* stream.c (open_fileno): If w_fdopen fails, close the
file descriptor before throwing exception.
|
|
|
|
| |
* stream.c (open_fileno): clear errno to 0 before fdopen.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* socket.c, socket.h: New files.
* Makefile: include new socket.o among objects if have_objects
variable is defined to 'y'.
* configure (have_sockets): New variable. New configure test
for socket-related functionality.
(HAVE_SOCKETS, HAVE_GETADDRINFO): New configuration
preprocessor symbols.
Also, reordering the shell probing so that /usr/xpg4/bin/sh
is the last fallback. On Solaris, it chokes on some code
that is needed for Solaris.
* lisplib.c (sock_set_entries, sock_instantiate): New static
functions.
(lisplib_init): Register new functions as autoload hooks.
* share/txr/stdlib/socket.tl: New file.
* stream.c (socket_error_s): New symbol variable.
(struct stdio_handle): New members, family and type, helping
stdio streams represent sockets too.
(stdio_stream_mark): Mark new members of struct stdio_handle.
(make_stdio_stream_common): Initialize new members.
(make_sock_stream, stream_fd, sock_family, sock_type,
open_socket, open_sockfd): New functions.
(stream_init): Initialize socket_error_s variable. Register
sock-family, sock-type and open-socket intrinsic functions.
Register socket-error subtype.
* stream.h (socket_error_s, make_sock_stream, stream_fd,
sock_family, sock_type, open_socket, open_sockfd):
Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (subtypep): Handle subtype check here between
stream and stdio-stream as a special case, since streams
aren't structures related by inheritance, but built-ins.
(class_check): If the type of obj doesn't match the class
exactly, use a subtypep check. We need this because stream
functions use this check, and stdio streams are not of the
stream type now.
* stream.c (stdio_stream_s): New global symbol variable.
(make_stdio_stream_common): Use stdio_stream_s symbol for the
type of stdio streams.
(stream_init): Intern the stdio-stream symbol, and store in
stdio_stream_s variable.
(streamp): Replace exact check with typep.
* stream.h (stdio_stream_s): Declared.
|
|
|
|
|
|
|
|
|
|
| |
This happened on 2015-07-29, before TXR 111,
"Deriving streams from the same base" commit.
* stream.c (string_in_get_char): Must retrieve the character
at the previous position, not the incremented one. Otherwise
we lose the first character, and of course we blow up with an
out of range access when we hit the end of the string.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* regex.c (read_until_match): New function.
(regex_init): Registered read-until-match intrinsic.
* regex.h (read_until_match): Declared.
* stream.c (struct delegate_base): New struct type.
(delegate_base_mark, delegate_put_string, delegate_put_char,
delegate_put_byte, delegate_get_char, delegate_get_byte,
delegate_unget_char, delegate_unget_byte, delegate_close,
delegate_flush, delegate_seek, delegate_truncate,
delegate_get_prop, delegate_set_prop, delegate_get_error,
delegate_get_error_str, delegate_clear_error,
make_delegate_stream): New static functions.
(struct record_adapter_base): New struct type.
(record_adapter_base_mark, record_adapter_mark_op,
record_adapter_get_line): New static functions.
(record_adapter_ops): New static structure.
(record_adapter): New function.
(stream_init): Registered record-adapter intrinsic.
* stream.h (record_adapter): Declared.
* txr.1: Documented read-until-match and record-adapter.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, 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, 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/cadr.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/struct.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, stream.c, stream.h, struct.c, struct.h,
sysif.c, sysif.h, syslog.c, syslog.h, txr.1, txr.c, txr.h,
unwind.c, unwind.h, utf8.c, utf8.h: Add 2016 copyright.
* linenoise/LICENSE, linenoise/linenoise.c,
linenoise/linenoise.h: Bump one principal author's copyright
from 2014 to 2015. The code is based on a snapshot of 2015
upstream work.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (obj_print_impl): Instead of hard-coded "~s", obtain
the format string for floats from the *print-flo-format*
special variable, whose default value is "~s".
* stream.c (print_flo_digits_s, print_flo_format_s): New symbol
variables.
(formatv): Use *print-flo-digits* value for default precision
for ~f and ~e, rather than hard-coded 3.
(stream_init): Initialize print_flo_digits_s and print_flo_format_s, and
register special variables under those symbols.
* stream.h (print_flo_digits_s, print_flo_format_s): Declared.
* txr.1: Documented new specials.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The #<lazy-string ...> print syntax is gone. Lazy strings are
now printed by traversing their structure, without forcing
them to the flat representation.
* lib.c (lazy_str_put): New function.
(out_str_char, out_str_pretty, out_lazy_str): New static functions.
(obj_print_impl): Use out_str_pretty for standard-printing
regular strings. Use lazy_put_str for pretty-printing lazy
strings, and out_lazy_str for standard-printing them.
* lib.h (lazy_str_put): Declared.
* stream.c (put_string): Check for a lazy string and route
to lazy_str_put, so the string doesn't get forced
(though of course the underlying list does, if it is lazy).
|
|
|
|
|
|
|
|
|
|
|
| |
Incorrect, irrelevant handle test inside stdio_get_line
virtual function fails to detect closed stream, leading
to a null pointer passed to the stdio library.
* stream.c (snarf_line): Rewrite according to pattern
followed by the other functions. We must test h->f for
null, not stream->co.handle, which never goes null
until the object is being reclaimed by gc.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.h (struct strm_ops): seek operation's second argument
is now just a val.
* stream.c (unimpl_seek, null_seek): Second argument is a val,
not cnum, to conform with function pointer in stream
structure.
(stdio_seek): Accept offset as val, which could be a fixnum
or bignum. Use new stdio_ftell and stdio_fseek functions
so large values work.
(seek_stream): No need to convert offset argument to cnum;
pass the val directly to seek virtual function.
* sysif.c (off_t_num, num_off_t, stdio_ftell,
stdio_fseek): New functions.
* sysif.h (OFF_T_MAX, OFF_T_MIN): New preprocessor symbols.
(off_t_num, num_off_t, stdio_ftell, stdio_fseek): Declared.
|
|
|
|
|
|
| |
* stream.c (formatv): The commit in which I added
the ~b specifier broke bignum octal printing due to
an incredibly silly typo.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* debug.c (show_bindings): Use ~d for level, so as
not to be influenced by *print-base*.
(debug): Use ~d for line numbers.
* lib.c (gensym): Use ~d conversion specifier
for formatting gensym counter into symbol name.
* match.c (LOG_MISMATCH, LOG_MATCH): Use ~d for
line number references.
(h_skip, h_coll, h_fun, h_chr, match_line_completely, v_skip,
v_fuzz, v_gather, v_collect, v_output, v_filter, v_fun,
v_assert, v_load, v_line, h_assert, open_data_source): Use ~d
for line refs, number of iterations, errno values.
* parser.c (repl): Use ~d for prompt line numbers,
numbered variables and the expr-<n> string in error
messages.
* parser.l (yyerrorf, source_loc_str): Use ~d for line
numbers.
* stream.c (print_base_s): New symbol variable.
(formatv): Implement *print-base*.
(stdio_maybe_read_error, stdio_maybe_error, stdio_close,
pipe_close, open_directory, open_file, open_fileno, open_tail,
open_process, run, remove_path): Use ~d for errno values.
(stream_init): Initialize print_base_s and register
*print-base* special variable.
sysif.c (mkdir_wrap, ensure_dir, getcwd_wrap, mknod_wrap,
chmod_wrap, symlink_wrap, link_wrap, readlink_wrap,
excec_wrap, stat_impl, pipe_wrap, poll_wrap, getgroups_wrap,
setuid_wrap, seteuid_wrap, setgid_wrap): Use ~d for
errno values and system function results.
* txr.1: Documented *print-base* and ~d conversion specifier.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure (have_dbl_decimal_dig): New variable.
New configure test to test for DBL_DECIMAL_DIG
or __DBL_DECIMAL_DIG__, resulting in FLO_MAX_DIG
macro being deposited in config.h.
* arith.c (arith_init): Register flo-max-dig variable.
* stream.c (print_flo_precision_s): New symbol variable.
(formatv): Obtain default precision from *print-flo-precision*
special variable, rather than hard coded DBL_DIG.
(stream_init): Initialize print_flo_precision_s variable,
and register *print-flo-precision* special.
* txr.1: Document flo-max-dig, *print-flo-precision*,
and change of behavior in format.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TXR is moving to custom assembly-language routines.
This is mainly motivated by a very dubious thing done in the
GNU C Library setjmp and longjmp in the name of security.
Evidently, glibc's setjmp "mangles" certain pointer values
which are stored into the jmp_buf buffer. It's been that way
since 2005, evidently. This means that, firstly, all along,
the use of setjmp in gc.c to get registers into a buffer so
they can be scanned has not actually worked properly. More
importantly, this pointer mangling in setjmp and longjmp is
very hostile to a stack copying implementation of delimited
continuations. The reason is that continuations contain
jmp_buf buffers, which get relocated in the process of
capturing and reviving a continuation. Any pointers in a
jmp_buf which point into the captured stack segment have to be
fixed up to point into the relocated location. Mangled
pointers make this difficult, requiring hacks which are
specific to glibc and the machine architecture. We might as
well implement a clean, well-behaved setjmp and longjmp.
* Makefile (jmp.o): New object file.
(dbg/%.o, opt/%.o): New rules for .S prerequisites.
* args.c, arith.c, cadr.c, combi.c, cadr.c, combi.c, debug.c,
eval.c, filter.c, glob.c, hash.c, lib.c, match.c, parser.c,
rand.c, regex.c, signal.c, stream.c, struct.c, sysif.c,
syslog.c, txr.c, unwind.c, utf8.c: Removed <setjmp.h>
include.
* gc.c: Switch to struct jmp and jmp_save, instead
of jmp_buf and setjmp.
* jmp.S: New source file.
* signal.h (struct jmp): New struct type.
(jmp_save, jmp_restore): New function declarations
denoting assembly language routines in jmp.S.
(extended_jmp_buf): Uses struct jmp instead of
setjmp.
(extended_setjmp): Use jmp_save instead of setjmp.
(extended_longjmp): Use jmp_restore instead of
longjmp.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: Test for ftruncate and chsize.
* stream.c (unimpl_truncate): New static function.
(fill_stream_ops): Default the truncate operation to unimpl_truncate.
(null_ops): Initialize truncate to unimpl_truncate.
(stdio_truncate): New static function.
(stdio_ops, tail_ops): Initialize truncate to stdio_truncate.
(pipe_ops, dir_ops, string_ops, byte_in_ops, string_out_ops,
strlist_out_ops, cat_stream_ops): Initialize truncate to null,
so it gets defaulted by fill_stream_ops.
(truncate_stream): New function.
(stream_init): Register truncate-stream intrinsic.
* stream.h (struct strm_ops): New member, truncate.
(strm_ops_init): New truncate argument added to macro.
(truncate_stream): Declared.
*syslog.c (syslog_strm_ops): Initialize truncate to null.
* txr.1: Documented.
|
|
|
|
|
| |
* stream.c (unimpl_seek): Function should identify itself
as seek-stream, not seek.
|
|
|
|
|
|
|
|
| |
* stream.c (formatv): New 'b' case along side 'o', handling
binary in straightforward way for bignums, and with binary
formatting loop code for fixnums.
* txr.1: Documented b.
|
|
|
|
|
|
|
|
|
|
| |
System depends on environment variables, and also causes
SIGINT and SIGQUIT to be ignored.
* stream.c (sh): Function rewritten in terms of sh,
in two platform variants.
* txr.1: Documented that sh doesn't use system as of TXR 120.
|
|
|
|
|
|
|
|
|
| |
* stream.c (find_char): Don't extract C string from string;
use abstract access to find the character, without
calculating length.
(string_in_get_line, string_in_get_char): Don't calculate
the length of the string to compare it to the position;
use the lazy-safe length_str_gt function instead.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Two-fold benefit. Simplifies code which allocates wchar_t
arrays. Provides overflow check for the multiplication.
* lib.c (chk_wmalloc): New function.
(chk_strdup, mkstring, mkustring, upcase_str, downcase_str,
sub_str, cat_str, trim_str): Use chk_wmalloc.
* lib.h (chk_wmalloc): Declared.
* stream.c (make_string_output_stream): Use chk_wmalloc.
* utf8.c (utf8_dup_from_uc, utf8_dup_from): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (split_str, split_str_set, list_str, int_str): Use
gc_hint rather than prot1/rel1. More efficient, doesn't
use space in the prot_stack array.
* regex.c (search_regex): Likewise.
* stream.c (vformat_str, formatv, run): Likewise.
In formatv, rel1 wasn't being called in the uw_unwind
block, so this fixes a bug.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (init): Move hash_init and struct init
before sysif_init.
* share/txr/stdlib/path-test.tl (sys:path-test-mode,
path-mine-p, path-my-group-p, sys:path-access,
path-newer, path-examine): Convert to struct return
of stat functions.
* stream.c (dev_k, ino_k, mode_k, nlink_k, uid_k,
gid_k, rdev_k, size_k, blksize_k, blocks_k, atime_k,
mtime_k, ctime_k): Global variable definitions removed from here.
(stream_init): Initializations of moved global
variables removed from here.
* stream.h (dev_k, ino_k, mode_k, nlink_k, uid_k,
gid_k, rdev_k, size_k, blksize_k, blocks_k, atime_k,
mtime_k, ctime_k): Declarations removed from here.
* sysif.c (stat_s, dev_s, ino_s, mode_s, nlink_s,
uid_s, gid_s, rdev_s, size_s, blksize_s, blocks_s,
atime_s, mtime_s, ctime_s): New global variables.
(dev_k, ino_k, mode_k, nlink_k, uid_k, gid_k, rdev_k,
size_k, blksize_k, blocks_k, atime_k, mtime_k,
ctime_k): Existing variables moved here.
(stat_to_struct): New static function.
(stat_impl): Use stat_to_struct, except under
113 compatibility.
(sysif_init): Initialize new symbol variables.
Make stat struct type.
* sysif.h (stat_s, dev_s, ino_s, mode_s, nlink_s,
uid_s, gid_s, rdev_s, size_s, blksize_s, blocks_s,
atime_s, mtime_s, ctime_s): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Macros called c_* should produce C counterparts of
Lisp val objects, like c_num and c_str.
* lib.h (c_true): Renamed to tnil.
* eval.c (lexical_var_p, lexical_fun_p): c_true to tnil.
* lib.c (less, chr_isalnum, chr_isalnum, chr_isalpha,
chr_isascii, chr_iscntrl, chr_isdigit, chr_isgraph,
chr_islower, chr_isprint, chr_ispunct, chr_isspace,
chr_isblank, chr_isunisp, chr_isupper, chr_isxdigit,
chr_toupper, keywordp): Likewise.
* stream.c (catenated_stream_p): Likewise.
* sysif.c (wifexited, wifsignaled, wcoredump, wifstopped,
wifcontinued): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* args.h (args_init_list, args_init): Return the
struct args * pointer.
(args_decl_list, args_decl): New macros.
* eval.c (apply, do_eval, expand_macro, op_dwim, op_catch,
(mapcarl, lazy_mapcarl): Switch to new macros.
* hash.c (hashl): Likewise.
* lib.c (generic_funcall, lazy_appendl, maxl, minl, funcall,
funcal1, funcall2, funcall3, funcall4, transpose, juxtv,
do_and, do_or, do_iff, unique): Likewise.
* match.c (h_fun, v_fun): Likewise.
* stream.c (vformat): Likewise.
* syslog.c (syslog_wrap): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Function arguments are now allocated on the stack using alloca,
in conjunction with the struct alloc header structure.
The generic_funcall and apply functions are refactored
for this, as are most functions that take variadic arguments.
* args.c (args_add_list, args_cons_list): Functions removed.
(args_normalize, args_normalize_fill): New functions.
(args_get_checked): Draw arguments from list when array runs out.
(args_copy, args_copy_zap): New functions.
* args.h (ARGS_MAX): Reduced to 32.
(ARGS_MIN): New preprocessor symbol.
(args_init): Call args_init_list.
(args_add2, args_add3, args_add4): New inline functions.
(args_more): Take into account list, which may hold additional arguments.
(args_two_more): New inline function.
(args_normalize, args_normalize_fill): Declared.
(args_get_list): Normalize all arguments into one list and return it.
(args_get_rest, args_at, args_atz): New inline functions.
(args_get): Draw arguments from list when array runs out.
(args_clear): New inline function.
* arith.c (maskv): Convert to new args.
* eval.c (APPLY_ARGS): Preprocessor symbol removed.
(bind_args): Converted to accept struct args.
(apply): Function reduced down to trivial adapter which
converts a list of arguments to args, and calls the new
generic_funcall.
(applyv): New static function: struct args wrapper
around apply_intrinsic.
(iapply): Converted to struct args.
(call): Static function removed. The call intrinsic
function binding now goes directly to generic_funcall.
(list_star_intrinsic, interp_fun): Converted to struct args.
(op_catch): Adjustments for bind_args, which requires
a struct args arglist.
(me_op): Must use the new minl and maxl, since minv and maxv
don't take lists any more.
(mapcarv, mappendv, lazy_mapcarv, lazy_mappendv, mapdov,
weavev, or_fun, and_fun, tf, nilf, do_retf, do_apf,
do_ipf, callf, do_mapf, mapf): Converted.
(mapcarl): New function, like the old mapcarv.
(eval_init): call_f initialized from generic_funcall
rather than call. apply registered to applyv rather than
apply_intrinsic. Registrations for zip, hash_from_pairs, vec,
alist-remove, alist-nremove, and throw similarly updated to
new or renamed functions.
* eval.h (interp_fun, mapcarv): Declarations updated.
(mapcarl): Declard.
* hash.c (hashv): Converted to struct args.
(hashl): New function.
(hash_construct): Use hashl, not hashv.
(hash_from_pairs, hash_list, group_by): Converted.
* hash.h (hashv, hash_construct, hash_from_pairs, hash_list,
group_by): Declarations updated.
(hashl): Declared.
* lib.c (appendv, nconcv, lazy_appendv): Converted to
struct args.
(lazy_appendl): New function.
(multi): Converted.
(listv): New function.
(nary_op, plusv, mulv, logandv, logiorv, gtv, ltv, gev, lev,
numeqv, numneqv, maxv, minv): Converted.
(maxl, minl): New functions, like old maxv and minv.
(exptv, gcdv, lcmv, lessv, greaterv, lequalv, gequalv): Converted.
(func_f0v, func_f1v, func_f2v, func_f3v, func_f4v): Converted.
(func_n0v, func_n1v, func_n2v, func_n3v, func_n4v): Converted.
(func_n0v, func_n1v, func_n2v, func_n3v, func_n4v): Converted.
(func_n1ov, func_n2ov, func_n3ov): Converted.
(generic_funcall): Converted to take struct args.
(funcall, funcall1, funcall2, funcall4): Pass stack-allocated
struct args as trailing arguments to variadic functions, and to
generic_funcall.
(do_curry_12_1_v): New struct-args-based static function,
needed to implement curry_12_1_v now.
(curry_12_1_v): Converted.
(transposev): New function based on previous tranpose.
(transpose): Now a wrapper for transposev.
(do_chain, chainv, do_chand, chandv, do_juxt, juxtv,
do_and, andv, do_or, orv, do_not, do_iff): Converted.
(vectorv): New function. Implementation basis for vec intrinsic function.
(alist_removev, alist_nremovev): New functions.
(multi_sort): Switch from mapcarv to mapcarl.
(unique): Converted.
(uniq): Allocate struct args for calling unique.
(obj_init): list_f function now based on new listv, rather than
identity.
* list.h (varg): New typedef.
(struct func): All variadic function pointers converted to use
struct args.
(appendv, nconcv, lazy_appendv, multi, nary_op, plusv, minusv,
mulv, gtv, ltv, gev, lev, numeqv, numneqv, maxv, minv, exptv,
gcdv, lcmv, logadnv, logiorv, maskv, lessv, greaterv, lequalv,
gequalv, func_f0v, func_f1v, func_f2v, func_f3v, func_f4v,
func_n0v, func_n1v, func_n2v, func_n3v, func_n4v, func_n0v,
func_n1v, func_n2v, func_n3v, func_n4v, func_n1ov, func_n2ov,
func_n3ov, generic_funcall, chainv, chandv, juxtv, adnv, orv,
unique): Declarations updated.
(lazy_appendl, listv, maxl, minl, transposev,
vectorv, alist_removev, alist_nremovev): Declared.
* stream.c (make_catenated_stream_v): New function.
(aformat): Renamed to formatv. The recognition of the nil
and t streams (standard output and string) is done here now.
(vformat): Follow rename of aformat to formatv.
(formatv): Function removed. Nobody calls this anymore.
(stream_init): make-catenated-stream re-registered to new
make_catenated_stream_v function.
* stream.h (formatv): Declaration updated.
(make_catenated_v): Declared.
* syslog.c (syslog_init): syslog registred to syslog_wrapv.
(syslog_wrapv): New function based on syslog_wrap converted to struct
args.
(syslog_wrap): Now wrapper for syslog_wrapv.
* syslog.h (syslog_wrapv): Declared.
* unwind.h (uw_throwv): New function.
(uw_throwfv, uw_errorfv): Converted to struct args.
* unwind.h (uw_throwv): Declared.
(uw_throwfv, uw_errorfv): Declarations updated.
|
|
|
|
| |
* stream.c (open_files, open_files_star): Refactored.
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (vformat): split into a new function called aformat,
and a small wrapper which retains the vformat name.
(aformat): New function formed from most of vformat. Takes
struct args * instead of va_list.
(formatv): Big switch statement hack gone. Now the function
fills in a struct args, allocated on the stack, with an accurate
size based on the args list. This is passed directly to
aformat.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Take into account string display width in field trimming and padding
calculations, including situations where only half a character fits.
* stream.c (calc_fitlen): New function.
(vformat_str): Revised to use calc_fitlen. If calc_fitlen indicates
that there is no trimming or padding, then use put_string rather than
put_char.
* txr.1: Update description of format with regard to use of
dispaly width in field calculations.
|
|
|
|
|
| |
* stream.c (vformat_str): Remove stray bogus code
that unconditionally outputs extra left padding.
|
|
|
|
|
|
| |
* stream.c (cat_get_line, cat_get_char, cat_get_byte)
Only close the head stream when popping it off
the list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* regex.c (create_wide_cs): New static function.
(wide_display_char_p): New function.
* regex.h (wide_display_char_p): Declared.
* stream.c (put_string, put_char): Use wide_display_char_p
to determine whether an extra column need be counted. Also bugfix:
iswprint evidently cannot be relied to work over the entire Unicode
range, at least not in the C locale. Glibc's version and is reporting
valid Japanese characters as unprintable on Ubuntu. As a hack we
instead check for control characters and invert the result: control
chars are unprintable.
* tests/009/json.expected: Updated.
|
|
|
|
|
|
|
|
|
| |
* glob.c (glob_wrap): Fix signed/unsigned comparison.
* stream.c (make_null_stream): Fix convert beign used
where coerce is needed.
* sysif.c (dup_wrap): Fix use of C++ new keyword.
|
|
|
|
| |
Needed on Cygwin.
|
|
|
|
|
|
|
|
| |
test-set-indent-mode, get-indent, set-indent, inc-indent
and width-check intrinsic functions. Register indent-off,
indent-data and indent-code variables.
* txr.1: Documented stream output indentation API.
|
|
|
|
|
| |
put_char function; no need to manipulate column
or call put_indent.
|
|
|
|
|
|
|
|
| |
to process all the characters as if by put_char,
(which we now do literally that way).
(set_indent_mode): Bugfix: no longer reset the column
to zero when turning off indent mode. This is wrong since
streams do column counting all the time.
|
|
|
|
|
|
|
| |
Allow negative widths to be specified with a leading minus sign,
so that we can indent to the left.
* txr.1: Document ~! format directive.
|
|
|
|
|
| |
immediately after outputting a newline. Rather, delay the output of the
indentation until some output occurs at column zero.
|
|
|
|
|
| |
zero, clamp it at zero.
(set_indent): Clamp indentation value to zero.
|
|
|
|
|
|
| |
meets a negative argument, the width should be treated
as positive and the field left aligned. Instead, the
width is treated as zero.
|
|
|
|
| |
buffer calculations overflow, but throw exception.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (vformat_align_pre, vformat_align_post): Change to void
return. Do not check return value of put_char.
(vformat_num, vformat_str): Change to void return. Do not check return
value of vformat_align_pre, vformat_aign_post or put_char.
(vformat): Do not check return value of vformat_str or vformat_num.
nilout exit point no longer needed.
(put_string): Do not intercept return value of ops->put_string.
Return t.
(put_char): Do not intercept return value of ops->put_char.
Do not check return value of put_indent. Return t.
* txr.1: Document t return of put-char, put-byte and put-string.
|
|
|
|
|
|
|
| |
logic hoisted into put_string.
(put_string, put_char): Always count column, indent mode or not.
* tests/009/json.expected: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_print_op): Take third argument,
and call cobj_print_impl rather than cobj_print.
* lib.c (cobj_print_op): Take third argument. The object class is
* printed with obj_print_impl.
(obj_print_impl): Static function becomes extern. Passes its pretty
flag argument to cobj print virtual function.
* lib.h (cobj_ops): print takes third argument.
(cobj_print_op): Declaration updated.
(obj_print_impl): Declared.
* regex.c (regex_print): Takes third argument, and ignores it.
* stream.c (stream_print_op, stdio_stream_print, cat_stream_print):
Take third argument, and ignore it.
* stream.h (stream_print_op): Declaration updated.
|
|
|
|
|
|
|
| |
* stream.c (struct string_output): Renamed to string_out.
(string_out_stream_destroy, string_out_byte_callback,
string_out_put_char, strnig_out_put_string, string_out_put_byte,
make_string_output_stream, get_string_from_stream): Follow rename.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (get_string_from_stream, get_list_from_stream,
stream_set_prop, stream_get_prop, close_stream, get_line,
get_char, get_byte, unget_char, unget_byte, put_string,
put_char, put_byte, flush_stream, seek_stream): Use cobj_handle and
cobj_ops instead of type_check and type_assert.
(get_indent_mode, test_set_indent_mode, set_indent_mode,
get_indent, set_indent, inc_indent, width_check): Use cobj_handle
and cobj_ops instead of stream->co.handle and stream->co.ops
for safety.
(vformat, format): Use class_check instead of type_check and
type_assert.
|