| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Renaming cobj_hash_op to cobj_eq_hash_op. This function is
only appropriate to use with COBJ objects which use
eq as their equal funtion. I've spotted one instance of an
inappropriate use which have to be addressed by a different
commit: the equal function is other than eq, but cobj_hash_op
is used for the equal hash.
* lib.h (cobj_hash_op): Declaration renamed to
cobj_eq_hash_op.
* hash.c (cobj_hash_op): Renamed to cobj_eq_hash_op.
(hash_iter_ops): Refer to renamed cobj_hash_eq_op.
* ffi.c (ffi_type_builtin_ops, ffi_type_struct_ops,
ffi_type_ptr_ops, ffi-closure_ops, ffi_call_desc_ops):
Likewise.
* lib.c (cptr_ops): Likewise.
* parser.c (parser_ops): Likewise.
* rand.c (random_state_ops): Likewise.
* regex.c (char_set_ops, regex_obj_ops): Likewise.
* socket.c (dgram_strm_ops): Likewise.
* stream.c (null_ops, 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, record_adapter_ops):
Likewise.
* struct.c (struct_type_ops): Likewise.
* sysif.c (cptr_dl_ops): Likewise.
* syslog.c (syslog_strm_ops): Likewise.
* unwind.c (cont_ops): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (make_catenated_stream): Fix incorrect order
of operations: list of streams stored into a structure
that is not yet visible to the garbage collector.
(Rules for coding this properly are explained in
HACKING.) This was found by running a test with --gc-debug
on 64 bit Darwin. The read_eval_stream function calls
make_catenated_stream with an argument that is freshly
constructed in the argument expression itself, triggering
the issue.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.h (default_bool_arg): Inline function renamed to
default_null_arg.
* eval.c (if_fun, pad, ginterate, giterate, range_star, range,
constantp, macroexpand_1, macro_form_p, expand_with_free_refs,
do_expand, eval_intrinsic, func_get_name, make_env_intrinsic):
Follow rename.
* arith.c (lognot): Likewise.
* gc.c (gc_finalize): Likewise.
* glob.c (glob_wrap): Likewise.
* hash.c (group_reduce, gethash_n): Likewise.
* lib.c (print, multi_sort, lazy_str, vector, iff, tok_str,
split_str_keep, search_str, remove_if, val): Likewise.
* match.c (match_fun): Likewise.
* parser.c (lisp_parse_impl, regex_parse): Likewise.
* rand.c (make_random_state): Likewise.
* regex.c (read_until_match, search_regex, regex_compile):
Likewise.
* socket.c (sock_accept, sock_connect): Likewise.
* stream.c (open_files_star, open_files, run, open_process,
open_tail, get_string, record_adapter): Likewise.
* struct.c (static_slot_ensure, static_slot_ens_rec,
clear_struct, make_struct_type): Likewise.
* sysif.c (exec_wrap, errno_wrap, cobj_ops_init): Likewise.
* unwind.c (uw_capture_cont, uw_find_frames_impl): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The print function now takes an optional boolean
for pretty printing.
The print method is also called with a third argument;
hence structures can customize both standard printing
and pretty printing.
* lib.c (obj_print): Take pretty argument, and pass it down
to obj_print_impl. This makes obj_pprint redundant.
(obj_pprint): Function removed: it was identical to obj_print
except for passing t down to obj_print_impl for the
pretty argument. These two wrappers had started small and
got bigger with identical changes done in parallel.
(pprint): New function.
(tostring, dump): Pass nil for pretty argument of obj_print.
(tostringp): Use pprint instead of obj_pprint.
* lib.h (obj_print): Declaration updated.
(obj_pprint): Declaration removed.
(print, pprint): Declared.
* eval.c (prinl): Pass nil for pretty_p argument of obj_print.
Do the stream defaulting here; obj_print doesn't do it.
(pprinl): Pass t for pretty_p argument of obj_print,
and do stream argument defaulting.
(eval_init): Register print to new print function rather
than directly to obj_print.
Register pprint to new pprint function rather than obj_pprint.
* hash.c (hash_print_op): Call obj_print_impl to print
the :equal-based keyword, rather than obj_print. Pass
down the pretty flag. All the other keywords are treated
this way; this fixes an inconsistency.
* match.c (dump_var): Call pprint instead of obj_pprint.
* stream.c (formatv): Call obj_print, with a calculated
pretty argument instead of switching between obj_pprint
and obj_print.
* struct.c (struct_inst_print): Except when in backward
compatibility mode, call the object's print method in both
pretty and regular printing mode, passing the mode as a third
argument.
* tests/012/oop.tl (defstruct animal): Support third argument
in print method. Make it optional because there are some
explicit calls which don't pass the argument.
* txr.1: Documentation updated for print method and the
print function. Revised text for some of the related
functions. Added compat notes.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* socket.c (dgram_get_byte_callback): nbytes must be volatile
because we assign to it after setting up the catch, and then
access it in the unwind code.
(sock_accept): Likewise.
* stream.c (generic_get_line): buf variable must be volatile.
(struct save_fds): The members of this structure must
be volatile; it's used as a local variable in a number of
functions in a way that requires volatile.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
* signal.c (set_signal_handler, get_sign_handler): Eliminate
newline in exception messages.
* stream.c (unimpl, formatv): Likewise.
* unwind.c (uw_block_abscond): Likewise.
|
|
|
|
|
|
|
|
| |
* stream.c (formatv): When the format string ends
at the point where the format character is expected
to occur, do not emit an error about #\nul being
an unknown format directive character; emit
an error that the character is missing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Retracting the recent change to add the "t" mode when
opening non-binary streams on Cygwin, which arranges
for line ending conversion. This restores the Unix-like
treatment of text files on Cygwin, which is expected
of programs.
The Windows native version of TXR will do line ending
conversion thanks to the behavior of text streams in the
Cygnal fork of Cygwin.
* stream.c (format_mode): Only add the "t" option
on Cygwin if compatibility with 144 and 145 is selected.
* txr.1: Updated compatibility notes.
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (shell, shell_arg): New variables.
(sh): Use shell and shell_arg, rather than hard-coded
"/bin/sh" and "-c".
(stream_init): Initialize shell and shell_arg to
POSIX values. On Cygwin, call getusershell, and if it
reports cmd.exe, use that instead, and adjust shell_arg
to "/c". This will happen if the Cygwin DLL being used
is the Cygnal version.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
mode by default, such that "\r\n" is converted to "\n".
Cygwin's stdio streams aren't doing this. This is fine when
working in the Cygwin world, but not fine when we are making a
"native" Windows program with the help of the Cygwin DLL.
However, Cygwin supports the "t" mode letter in fopen, and
that forces a text mode which does the conversion.
* stream.c (format_mode): On Cygwin, if the mode isn't
binary, add the 't' letter to the normalized mode
string, unless compatibility <= 143 is requested.
* txr.1: Added compat notes.
|
|
|
|
|
| |
* stream.c (struct stdio_handle): Members is_rotated,
is_real_time and is_byte_oriented become bitfields.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (CONFIG_STDIO_STRICT): New preprocessor symbol.
(enum stdio_op): New enum.
(struct stdio_handle): New member, last_op.
(stdio_switch): New static function, or macro.
(stdio_put_string, stdio_put_char, stdio_put_byte): Indicate
possible switch to write mode via stdio_switch.
(stdio_flush): If the last direction wasn't write,
don't bother doing anything.
(stdio_get_char, stdio_get_byte): Indicate possible switch to
read mode.
(tail_strategy): Set last mode to stdio_none whenever new
FILE * stream is installed.
(make_stdio_stream_common): Initialize last_op member.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (byte_oriented_k): New keyword symbol variable.
(struct stdio_handle): New member, is_byte_oriented.
(stdio_get_prop): Retrieve the value of is_byte_oriented when
the :byte-oriented property is inquired.
(stdio_set_prop): Map :byte-oriented to the is_byte_oriented
flag.
(stdio_get_char): Do not decode UTF-8 if is_byte_oriented is
set; just read one character.
(make_stdio_stream_common): Initialize is_byte_oriented to 0.
(stream_init): Initialize byte_oriented_k.
* txr.1: Document :byte-oriented property, along
with some clean-up and clarification in the description of
properties.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Let's use our usleep_wrap function which uses nanosleep.
The old sleep can interact with SIGALRM.
* stream.c (tail_calc): Calculate microseconds instead
of seconds.
(sleep): Wrapper for Windows gone.
(tail_strategy): Rename sec variable to usec. Use
usleep_wrap instead of sleep.
* sysif.c (usleep_wrap): Change to extern.
* sysif.h (usleep_wrap): Declaration updated.
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
| |
* stream.c (record_adapter): Use default_bool_arg
rather than tnil. Since rb->include_match ends up passed
directly to read_until_match, which deals with argument
defaulting, we could just store the argument value into the
structure.
|
|
|
|
|
|
|
|
|
| |
* stream.c (flush_stream): Default the argument to
std_output.
(stream_init): Register flush-stream as having one
optional arg.
* txr.1: Updated flush-stream description.
|
|
|
|
|
| |
* stream.c (string_in_get_prop): Do not format stream address
into name; the general stream_print_op already adds that.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When subprocesses are created using open-command,
open-process, run or sh, any streams not bound by
those functions are obtained from *stdin*, *stdout*
or *stderr*, as appropriate. Thus manipulating these
variables has the effect of redirecting not only
local output within the program but over coprocesses
as well.
* stream.c (struct save_fds): New type.
(FDS_IN, FDS_OUT, FDS_ERR): New macros.
(fds_init, fds_subst, fds_swizzle, fds_restore): New static
functions.
(open_command, open_process, run): "Swizzle" and restore
the standard file descriptors.
* txr.1: Updated documentation of affected function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* glob.c (glob_wrap): Perform argument conversions
that might throw before allocating UTF-8 string.
* parser.y (text): In the action for SPACE, the lexeme
is not needed so free($1) right away. If regex_compile
were to throw an exception, that lexeme will leak.
* socket.c (getaddrinfo_wrap): Harden against leakage of
node_u8 and service_u8 strings with an unwind block.
For instance, the hints structure could contain
bad values which cause addrinfo_in to throw.
* stream.c (make_string_byte_input_stream): Perform
possibly throwing argument conversions before allocating
resources.
* sysif.c (mkdir_wrap, mknod_wrap, chmod_wrap, symlink_wrap,
link_wrap, setenv_wrap, crypt_wrap): Likewise.
* syslog.c (openlog_wrap, syslog_wrapv): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* regex.c (ead_until_match): Use rcyc_pop instead of pop
to move the conses to the recycle list. We know these
are not shared with anything. Adding additional logic
to completely recycle the stack.
* socket.c (dgram_get_char): Use rcyc_pop to
get the character from the push-back list.
* stream.c (stdio_get_char): Likewise.
|
|
|
|
|
| |
* stream.c (get_string): The optional stream argument
must be treated accordingly.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixing read_until_match will require this feature.
* socket.c (dgram_get_char): Treat unget_c as a
cons-based stack; pop a character from it if
available.
(dgram_unget_char): Push the character onto unget_c
rather than storing the characer into unget_c.
* stream.c (stdio_get_char, stdio_unget_char): Closely
analogous changes to the ones in dgram_get_char
and dgram_unget_char, respectively.
* txr.1: Documentation improved and updated.
|
|
|
|
|
| |
* stream.c (string_in_unget_char): Missing
argument in uw_throwf call.
|
|
|
|
|
|
| |
* stream.c (string_in_unget_char): Store the updated
position into the stream, rather than the original
value, which does nothing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (do_parse_mode): New static function.
(parse_mode): Logic moved into do_parse_mode, leaving this
function as a wrapper for do_parse_mode. Check added
for malformed mode, so functions which call parse_mode
now have the check. Added defaulting for mode_str
argument, inside do_parse_mode.
(normalize_mode): Call do_parse_mode instead of parse_mode.
Don't default mode_str argument, since do_parse_mode
does that.
|
|
|
|
|
|
|
|
| |
* stream.c (fmt): New function.
* stream.h (fmt): Declared.
* txr.1: Documented.
|
|
|
|
|
|
| |
* stream.c (delegate_get_sock_family, delegate_get_sock_type,
delegate_get_sock_peer, delegate_set_sock_peer): These functions should
only be defined if HAVE_SOCKETS is true.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The main aim here is to pave the way for conversion between
arbitrary buffers of bytes (that may include embedded NUL
characters) and a wide string.
Also, a potential security hole is closed. When we convert a
TXR string to UTF-8 for use with some C library API, any
embedded pnul characters (U+DC00) turn into NUL
bytes which effectively cut the UTF-8 string short, and
silently so. The C library function receives a shortened
string. This could be exploitable in some situations.
* lib.c (int_str): Use utf8_dup_to_buf instead of
utf8_dup_to_uc. Pass 1 to have the buffer null-terminated,
since mp_read_radix depends on it.
* stream.c (make_string_byte_input_stream): Use
utf8_dup_to_buf. This gives us the size, soo we don't have to
call strlen. The buffer is no longer null terminated, but the
byte input stream implementation never relied on this.
* utf8.c (utf8_from_buf): Replacement fors utf8_from_uc
which doesn't assume that the buffer of bytes is
null-terminated. It can produce a wide string containing
U+DC00 characters corresponding to embedded nulls in the
original buffer.
(utf8_from): Calculate length of null-terminated string and use
utf8_from_buf.
(utf8_to_buf): Replacement for utf8_to_uc. Can produce
a buffer which is or is not null-terminated, based on new
argument.
(utf8_to): Use utf8_to_buf, and ask it to null-terminate,
thus preserving behavior.
(utf8_dup_from_uc): This function was not used anywhere
and is removed.
(utf8_dup_to_buf): Replacement for utf8_dup_to_uc which
takes an extra agrgument, whether to null-terminate
or not.
(utf8_dup_to): Apply security check here: is the resulting
string as long as utf8_to says it should be? If not,
it contains embedded nulls. Throw an exception.
* utf.h (utf8_from_uc, utf8_to_uc, utf8_dup_from_uc,
utf8_dup_to_uc): Declarations removed.
(utf8_from_buf, utf8_to_buf, utf8_dup_to_buf): Declared.
|
|
|
|
| |
* stream.c (stream_init): Register sock-set-peer intrinsic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* gc.c (gc_report_copies): C style casts found in this
function.
* linenoise.c (strip_qual, convert, coerce): Copy and paste
the macros here.
(record_undo, compare_completions, lino_add_completion,
history_search, ab_append, sync_data_to_buf,
refresh_singleline, screen_rows, refresh_multiline,
find_nearest_paren, paren_jump, yank_sel,
edit_move_matching_paren, edit, lino_make, lino_copy,
lino_hist_add, lino_hist_set_max_len): C style casts
replaced.
* mpi/mpi-types.h (MP_DIGIT_BIT, MP_DIGIT_MAX, MP_WORD_BIT,
MP_WORD_MAX, RADIX): C style casts replaced.
* mpi/mpi.c (convert, coerce): Copy and paste the macros here.
(mp_init_size, mp_init_copy, mp_copy, mp_set_int, mp_div_d,
mp_bit, mp_to_double, mp_to_signed_bin, mp_to_unsigned_bin,
mp_to_unsigned_buf, mp_toradix_case, mp_grow, s_mp_set_bit,
s_mp_mod_2d, s_mp_mul_2d, s_mp_div_2d, s_mp_mul_d, s_mp_mul,
s_mp_sqr, s_mp_div, s_mp_2expt, s_mp_todigit): C style
casts replaced.
* mpi/mplogic (convert): Macro copy and pasted here.
(mpl_num_set, mpl_num_clear): C style casts replaced.
* parser.c (provide_completions): Likewise.
* signal.c (small_sigfillset): Likewise.
* stream.c (stdio_truncate, test_set_indent_mode,
set_indent_mode): Likewise.
|
|
|
|
|
|
|
|
|
| |
* stream.c (tail_strategy): Apply the mode whenever a new
stream is opened.
(open_tail): Store the original mode string in h->mode
rather than the normalized one, so in tail_strategy
we can apply all the same attributes to a newly opened
stream that we applied to the original stream.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
* stream.c (stdio_unget_byte): Set errno to zero before
ungetc, because ungetc probably almost certainly
doesn't set errno when it fails.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (timeout_error_s): New symbol variable.
(obj_init): Intern timeout-error, init new variable.
* lib.h (timeout_error_s): Declared.
* socket.c (sock_timeout, sock_send_timeout,
sock_recv_timeout): New static functions.
(sock_load_init): Register sock-send-timeout and
sock-recv-timeout intrinsics.
* stream.c (stdio_maybe_read_error, stdio_maybe_error):
Convert EAGAIN into timeout_error_s.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
| |
* socket.c (open_sockfd): We no longer need to set
stream sockets to line buffered mode here;
it's done in set_mode_props.
* stream.c (set_mode_props): If the mode specifies interactive,
streams open for writing are also switched to line buffering.
* txr.1: Documented under open-file, and open-socket.
|
|
|
|
|
|
|
|
|
|
|
| |
This fix is required for the stream socket test case to pass.
Some interaction between a stdio stream in line buffering
mode and the putc function causes a stream to lose data.
If we use fputs instead to output a character, the
issue goes away.
* stream.c (se_putc): When compiling for Cygwin, construct
a one-character-long string and use fputs, rather than putc.
|
|
|
|
|
|
|
| |
* stream.c (delegate_get_sock_family, delegate_get_sock_type,
delegate_get_sock_peer, delegate_set_sock_peer): New static
functions.
(stream_init): Wire new functions in record_adapter_ops.
|