| Commit message (Expand) | Author | Age | Files | Lines |
* | Remove unnecessary scm_i_string_start_writing calls...* libguile/strings.c (scm_string, scm_c_make_string):
* libguile/srfi-13.c (scm_reverse_list_to_string, scm_string_map)
(scm_string_unfold, scm_string_unfold_right, scm_xsubstring)
(scm_string_filter, scm_string_delete): Remove
scm_i_string_start_writing / scm_i_string_stop_writing calls around
fresh strings that aren't visible to other threads.
| Andy Wingo | 2017-02-16 | 1 | -4/+2 |
* | Elide syscalls in fdes->port...* libguile/fports.h (scm_t_fport): Add options field.
(SCM_FDES_RANDOM_P): Deprecate.
(scm_i_fdes_to_port): Add options argument.
* libguile/fports.c (scm_i_fdes_to_port): Add options argument. Only
verify FD if SCM_FPORT_OPTION_VERIFY is there.
(scm_fdes_to_port, scm_open_file_with_encoding): Adapt to
scm_i_fdes_to_port changes.
(fport_random_access_p): Don't try to seek if NOT_SEEKABLE option is
set.
* libguile/deprecated.h:
* libguile/deprecated.c (SCM_FDES_RANDOM_P): Deprecate.
* NEWS: Add deprecation.
* libguile/filesys.c:
* libguile/ioext.c:
* libguile/posix.c:
* libguile/read.c:
* libguile/socket.c: Adapt callers.
| Andy Wingo | 2017-02-14 | 1 | -10/+6 |
* | Prevent TOCTTOU bugs in C ports...* libguile/ports-internal.h (scm_port_buffer_can_take):
(scm_port_buffer_can_put): Add cur/end output arguments so that when a
caller asks the buffer room, it can be relative to a fixed point in
the buffer and not whatever point it's at when we go to fill it.
(scm_port_buffer_did_take, scm_port_buffer_did_put): Similarly,
require that the caller knows where they took/put data in the buffer.
Prevents overflow.
(scm_port_buffer_take_pointer, scm_port_buffer_put_pointer): Likewise,
require that the caller has already checked and knows a position in
the buffer and therefore how much data is available.
(scm_port_buffer_take, scm_port_buffer_put, scm_port_buffer_putback):
Adapt.
* libguile/ports.h (scm_fill_input): Add cur/avail output arguments.
* libguile/filesys.c:
* libguile/poll.c:
* libguile/ports.c:
* libguile/r6rs-ports.c:
* libguile/read.c:
* libguile/rw.c: Adapt all callers. Gnarly work!
| Andy Wingo | 2017-02-08 | 1 | -5/+4 |
* | Deprecate dynamic roots...* libguile/root.h:
* libguile/root.c: Remove these files.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_internal_cwdr, scm_call_with_dynamic_root)
(scm_dynamic_root, scm_apply_with_dynamic_root): Deprecate.
Remove all root.h usage, which was vestigial.
* module/ice-9/serialize.scm: Use (current-thread) instead
of (dynamic-root).
| Andy Wingo | 2016-11-21 | 1 | -1/+0 |
* | Avoid compilation warnings about alloca in read.c...* libguile/read.c: Include alloca.h.
| Eli Zaretskii | 2016-07-25 | 1 | -0/+1 |
* | Heed the reader settings implied by #!r6rs...When encountering the #!r6rs directive, apply the appropriate reader
settings to the port.
* libguile/read.scm (read-string-as-list): New helper procedure.
(scm_read_shebang): Set reader options implied by the R6RS syntax
upon encountering the #!r6rs directive.
* test-suite/tests/reader.test (per-port-read-options): Add tests for
the #!r6rs directive.
| Andreas Rottmann | 2016-05-22 | 1 | -2/+38 |
* | Speed up port position access from Scheme...* libguile/ports-internal.h (scm_port_buffer_position):
(scm_port_position_line, scm_port_position_set_line):
(scm_port_position_column, scm_port_position_set_column): New
helpers.
(scm_t_port): Ports now hold position as a pair, so that Scheme can
access it easily.
(SCM_LINUM, SCM_COL, SCM_INCLINE, SCM_ZEROCOL, SCM_INCCOL)
(SCM_DECCOL, SCM_TABCOL): Remove.
* libguile/ports.c (make_port_buffer): Rename from
scm_c_make_port_buffer, make static, and take port as an argument so
we can initialize the position field.
(initialize_port_buffers): Adapt make_port_buffer change.
(scm_c_make_port_with_encoding): Initialize position.
(update_port_position): Rename from update_port_lf, and operate on
port position objects.
(scm_ungetc): Operate on port position objects.
(scm_setvbuf, scm_expand_port_read_buffer_x): Adapt to
make_port_buffer change.
(scm_lfwrite): Adapt to call update_port_position.
(scm_port_line, scm_set_port_line_x, scm_port_column)
(scm_set_port_column_x): Adapt to use port positions.
* libguile/ports.h (scm_c_make_port_buffer): Remove internal decl.
* libguile/read.c: Adapt to use scm_port_line / scm_port_column instead
of SCM_LINUM et al.
* module/ice-9/ports.scm (port-buffer-position, port-position-line)
(port-position-column, set-port-position-line!)
(set-port-position-column!): New accessors for the internals module.
* module/ice-9/sports.scm (advance-port-position!): Rename from
port-advance-position! and use the new accessors.
(read-char, port-fold-chars/iso-8859-1): Adapt to use
advance-port-position!.
| Andy Wingo | 2016-05-22 | 1 | -25/+33 |
* | Remove scm_t_port_internal...* libguile/ports-internal.h (SCM_PORT): Rename from SCM_PTAB_ENTRY.
(scm_t_port_internal, SCM_PORT_GET_INTERNAL): Remove.
(SCM_FILENAME, SCM_SET_FILENAME, SCM_LINUM, SCM_COL): Adapt.
* libguile/ports.c:
* libguile/poll.c:
* libguile/ioext.c:
* libguile/fports.c:
* libguile/filesys.c:
* libguile/print.c:
* libguile/read.c:
* libguile/rw.c:
* libguile/strings.c: Adapt.
| Andy Wingo | 2016-05-13 | 1 | -5/+5 |
* | Make port buffering fields private...* libguile/ports-internal.h (enum scm_port_buffer_field)
(scm_t_port_internal): Make port buffering fields private.
* libguile/ports.h (scm_t_port): Adapt.
* libguile/filesys.c (set_element):
* libguile/ioext.c (scm_redirect_port):
* libguile/poll.c (scm_primitive_poll):
* libguile/ports.c:
* libguile/read.c (scm_i_scan_for_encoding):
* libguile/rw.c (scm_write_string_partial): Adapt users.
| Andy Wingo | 2016-05-13 | 1 | -4/+4 |
* | Port encoding internally represented as symbol...* libguile/ports-internal.h (scm_t_port_internal): Remove encoding_mode
member.
* libguile/ports.h (scm_t_port): "encoding" member is now a SCM symbol.
* libguile/ports.c (scm_init_ports): Define symbols for the encodings
that we handle explicitly.
(encoding_matches): Adapt to check against an encoding as a symbol.
(canonicalize_encoding): Return an encoding as a symbol.
(scm_c_make_port_with_encoding, scm_i_set_default_port_encoding)
(decide_utf16_encoding, decide_utf32_encoding)
(scm_i_port_iconv_descriptors, scm_i_set_port_encoding_x)
(scm_port_encoding, peek_codepoint, scm_ungetc): Adapt to encoding
change.
* libguile/print.c (display_string_using_iconv, display_string):
* libguile/read.c (scm_read_character):
* libguile/strings.c (scm_from_port_stringn, scm_to_port_stringn): Adapt
to port encoding change.
| Andy Wingo | 2016-05-03 | 1 | -3/+4 |
* | scm_fill_input can guarantee a minimum fill amount...* libguile/ports.h (scm_fill_input): Add "minimum_size" argument. Adapt
all callers to pass 0 as this argument.
* libguile/ports.c (scm_i_read): Inline into scm_fill_input.
(scm_fill_input): "minimum_size" argument ensures that there are a
certain number of bytes available, or EOF. Instead of shrinking the
read buffer, only fill by the read_buffering amount, or the
minimum_size, whichever is larger.
* libguile/r6rs-ports.c:
* libguile/read.c: Adapt scm_fill_input callers.
| Andy Wingo | 2016-05-01 | 1 | -1/+1 |
* | Remove port locking around write, display...* libguile/print.c (scm_write, scm_display):
* libguile/read.c (set_port_read_option): Remove port locking. Reading
and writing to the same port from multiple threads just must not
crash; it doesn't have to make sense.
| Andy Wingo | 2016-04-28 | 1 | -5/+0 |
* | Remove scm_fill_input_unlocked...* libguile/ports.h (scm_fill_input_unlocked): Remove.
* libguile/ports.c (scm_fill_input): Rename from
scm_fill_input_unlocked. Adapt callers.
* libguile/r6rs-ports.c (scm_get_bytevector_some): Adapt.
* libguile/read.c (scm_i_scan_for_encoding): Adapt.
| Andy Wingo | 2016-04-26 | 1 | -1/+1 |
* | scm_ungetc, scm_ungets instead of _unlocked variants...* libguile/ports.h (scm_ungetc_unlocked, scm_ungets_unlocked): Remove;
replace with scm_ungetc, scm_ungets.
* libguile/ports.c (scm_ungetc, scm_ungets, scm_unread_char)
(scm_unread_string): Adapt.
* libguile/rdelim.c (scm_read_delimited_x): Use scm_ungetc.
* libguile/read.c: Unread characers with scm_ungetc, not
scm_ungetc_unlocked.
| Andy Wingo | 2016-04-23 | 1 | -21/+21 |
* | Remove scm_unget_{byte,bytes}_unlocked...* libguile/ports.h (scm_unget_bytes_unlocked, scm_unget_byte_unlocked):
Remove.
* libguile/ports.c (looking_at_bytes): Use scm_unget_bytes instead of
scm_i_unget_bytes_unlocked
(scm_unget_bytes): Rename from scm_i_unget_bytes_unlocked. Remove
other implementations of this function.
(scm_unget_byte): Likewise.
(scm_ungetc_unlocked, scm_peek_char): Use scm_unget_byte.
* libguile/read.c (read_token): Use scm_unget_byte.
| Andy Wingo | 2016-04-23 | 1 | -1/+1 |
* | Replace scm_getc with scm_getc_unlocked...* libguile/ports.h (scm_getc_unlocked): Remove, or rather rename to
scm_getc. This probably introduces some thread-related bugs but we'll
fix them in a different way.
* libguile/ports.c (scm_getc): Rename from scm_getc_unlocked, replacing
the locky implementation.
(scm_read_char): Use scm_getc.
* libguile/r6rs-ports.c (scm_get_string_n_x): Use scm_getc.
* libguile/rdelim.c (scm_read_delimited_x, scm_read_line): Use
scm_getc.
* libguile/read.c: Use scm_getc.
| Andy Wingo | 2016-04-23 | 1 | -31/+31 |
* | Remove scm_flush_unlocked / scm_end_input_unlocked...* libguile/ports.h (scm_flush_unlocked, scm_end_input_unlocked):
Remove.
* libguile/ports.c (scm_c_read_bytes_unlocked):
(scm_i_unget_bytes_unlocked, scm_setvbuf, scm_force_output)
(scm_fill_input_unlocked, scm_c_write_bytes_unlocked)
(scm_c_write_unlocked, scm_lfwrite_unlocked, scm_seek)
(scm_truncate_file, flush_output_port): Call scm_flush / scm_end_input
instead of the _unlocked variants.
(scm_end_input): Lock while discarding the input buffer but not while
calling out to the seek function.
* libguile/filesys.c (scm_fsync):
* libguile/ioext.c (scm_redirect_port):
* libguile/read.c (scm_i_scan_for_encoding):
* libguile/rw.c (scm_write_string_partial): Use scm_flush, not
scm_flush_unlocked.
| Andy Wingo | 2016-04-23 | 1 | -1/+1 |
* | Remove port rw_active field...* libguile/ports.h (scm_t_port_rw_active): Move type definition to
ports-internal.h.
(scm_t_port): Remove rw_active field. It's sufficient to check the
port buffer cursors.
* libguile/read.c (scm_i_scan_for_encoding): Just call
scm_flush_unlocked; it's idempotent.
* libguile/ports.c (scm_c_make_port_with_encoding): Remove rw_active
field.
(scm_c_read_bytes_unlocked, scm_c_read, scm_i_unget_bytes_unlocked)
(scm_end_input_unlocked, scm_flush_unlocked, scm_fill_input_unlocked)
(scm_port_write_buffer, scm_port_read_buffer)
(scm_c_write_bytes_unlocked, scm_c_write_unlocked, scm_seek): Remove
management of rw_active field.
| Andy Wingo | 2016-04-22 | 1 | -5/+1 |
* | scm_c_read instead of scm_c_read_unlock...* libguile/ports.h (scm_c_read_unlocked): Remove.
* libguile/ports.c (scm_c_read): Rename from scm_c_read_unlocked.
Remove old scm_c_read. Lock around access to the rw_active flag, and
call scm_flush instead of scm_flush_unlocked, and scm_fill_input
instead of scm_fill_input_unlocked.
* libguile/read.c (scm_i_scan_for_encoding): Use scm_c_read instead of
the _unlocked function.
| Andy Wingo | 2016-04-22 | 1 | -1/+1 |
* | Refactor to internal get/peek-byte functions...* libguile/ports.h (scm_get_byte_or_eof_unlocked)
(scm_peek_byte_or_eof_unlocked): Remove inline functions. The
important uses are in ports.c anyway and we will use a static function
there.
(scm_slow_get_byte_or_eof_unlocked)
(scm_slow_peek_byte_or_eof_unlocked): Remove declarations without
definitions.
* libguile/ports.c (looking_at_bytes): Use scm_peek_byte_or_eof instead
of the _unlocked variant.
(get_byte_or_eof, peek_byte_or_eof): New static functions.
(scm_get_byte_or_eof, scm_peek_byte_or_eof): Don't lock: the port
buffer mechanism means that we won't crash. More comments to come.
(get_utf8_codepoint, get_latin1_codepoint, get_iconv_codepoint): Use
new static functions.
* libguile/read.c (read_token, scm_read_semicolon_comment): Use
scm_get_byte_or_eof, not scm_get_byte_or_eof_unlocked.
| Andy Wingo | 2016-04-22 | 1 | -3/+3 |
* | Port buffers are Scheme values...* libguile/ports-internal.h (scm_port_buffer_bytevector)
(scm_port_buffer_cur, scm_port_buffer_set_cur)
(scm_port_buffer_end, scm_port_buffer_set_end)
(scm_port_buffer_has_eof_p, scm_port_buffer_set_has_eof_p): New
helpers.
* libguile/ports-internal.h (scm_port_buffer_size)
(scm_port_buffer_reset, scm_port_buffer_reset_end)
(scm_port_buffer_can_take, scm_port_buffer_can_put)
(scm_port_buffer_can_putback, scm_port_buffer_did_take)
(scm_port_buffer_did_put, scm_port_buffer_take_pointer)
(scm_port_buffer_put_pointer, scm_port_buffer_take)
(scm_port_buffer_put, scm_port_buffer_putback): Adapt to treat port
buffers as SCM values and use helpers to access them.
* libguile/ports.c (scm_i_clear_pending_eof, scm_i_set_pending_eof)
(scm_c_make_port_buffer, scm_i_read_unlocked)
(scm_c_read_bytes_unlocked, scm_i_unget_bytes_unlocked)
(scm_setvbuf, scm_fill_input, scm_take_from_input_buffers)
(scm_drain_input, scm_end_input_unlocked, scm_flush_unlocked)
(scm_fill_input_unlocked, scm_i_write_unlocked)
(scm_c_write_bytes_unlocked, scm_c_write_unlocked)
(scm_char_ready_p): Adapt to treat port buffers as SCM values and use
helpers to access them.
(scm_port_read_buffer, scm_port_write_buffer): New functions,
allowing (ice-9 ports) to access port buffers.
* libguile/ports.h: Update comments on port buffers. Replace
scm_t_port_buffer structure with a Scheme vector whose fields are
enumerated by "enum scm_port_buffer_field".
(scm_get_byte_or_eof_unlocked, scm_peek_byte_or_eof_unlocked): Adapt
these implementations to port buffer representation change.
* libguile/r6rs-ports.c (scm_get_bytevector_some):
* libguile/read.c (scm_i_scan_for_encoding):
* libguile/rw.c (scm_write_string_partial): Port buffers are Scheme
objects.
| Andy Wingo | 2016-04-20 | 1 | -1/+1 |
* | Port buffer cur/next pointers are Scheme values...* libguile/ports.h (scm_t_port_buffer): Change "cur" and "end" members
to be SCM values, in preparation for changing port buffers to be
Scheme vectors.
(scm_get_byte_or_eof_unlocked, scm_peek_byte_or_eof_unlocked): Adapt.
* libguile/ports.c (scm_c_make_port_buffer): Initialize cur and end
members.
(looking_at_bytes): Use helper instead of incrementing cur.
(scm_i_read_unlocked): Adapt to end type change.
(CONSUME_PEEKED_BYTE): Use helper instead of incrementing cur.
(scm_i_unget_bytes_unlocked): Use helper instead of comparing cur.
(scm_i_write_unlocked): Fix for changing end/cur types.
* libguile/read.c (scm_i_scan_for_encoding): Use helpers instead of
addressing cursors directly.
* libguile/rw.c (scm_write_string_partial): Likewise.
* libguile/ports-internal.h (scm_port_buffer_reset):
(scm_port_buffer_reset_end, scm_port_buffer_can_take):
(scm_port_buffer_can_put, scm_port_buffer_can_putback):
(scm_port_buffer_did_take, scm_port_buffer_did_put):
(scm_port_buffer_take_pointer, scm_port_buffer_put_pointer):
(scm_port_buffer_putback): Adapt to data types.
| Andy Wingo | 2016-04-19 | 1 | -2/+2 |
* | Remove "buf" field from port buffers...* libguile/ports-internal.h (scm_port_buffer_reset_end): New helper.
(scm_port_buffer_putback): New helper.
* libguile/ports.h (scm_t_port_buffer): Remove "buf" field.
(scm_get_byte_or_eof_unlocked, scm_peek_byte_or_eof_unlocked): Adapt.
* libguile/ports.c (scm_c_make_port_buffer): No more "buf" field.
(scm_i_unget_bytes_unlocked): Use helper.
* libguile/read.c (scm_i_scan_for_encoding): No more "buf" field.
| Andy Wingo | 2016-04-18 | 1 | -1/+1 |
* | Generic port facility provides buffering uniformly...* libguile/ports.h (struct scm_t_port_buffer): New data type.
(struct scm_t_port): Refactor to use port buffers instead of
implementation-managed read and write pointers. Add "read_buffering"
member.
(SCM_INITIAL_PUTBACK_BUF_SIZE, SCM_READ_BUFFER_EMPTY_P): Remove.
(scm_t_ptob_descriptor): Rename "fill_input" function to "read", and
take a port buffer, returning void. Likewise "write" takes a port
buffer and returns void. Remove "end_input"; instead if there is
buffered input and rw_random is true, then there must be a seek
function, so just seek back if needed. Remove "flush"; instead all
calls to the "write" function implicitly include a "flush", since the
buffering happens in the generic port code now. Remove "setvbuf", but
add "get_natural_buffer_sizes"; instead the generic port code can
buffer any port.
(scm_make_port_type): Adapt to read and write prototype changes.
(scm_set_port_flush, scm_set_port_end_input, scm_set_port_setvbuf):
Remove.
(scm_slow_get_byte_or_eof_unlocked)
(scm_slow_get_peek_or_eof_unlocked): Remove; the slow path is to call
scm_fill_input.
(scm_set_port_get_natural_buffer_sizes): New function.
(scm_c_make_port_buffer): New internal function.
(scm_port_non_buffer): Remove. This was a function for
implementations that is no longer needed. Instead open with BUF0 or
use (setvbuf port 'none).
(scm_fill_input, scm_fill_input_unlocked): Return the filled port
buffer.
(scm_get_byte_or_eof_unlocked, scm_peek_byte_or_eof_unlocked): Adapt
to changes in buffering and EOF management.
* libguile/ports.c: Adapt to port interface changes.
(initialize_port_buffers): New function, using the port mode flags to
set up appropriate initial buffering for all ports.
(scm_c_make_port_with_encoding): Create port buffers here instead of
delegating to implementations.
(scm_close_port): Flush the port if needed instead of delegating to
the implementation.
* libguile/filesys.c (set_element): Adapt to buffering changes.
* libguile/fports.c (fport_get_natural_buffer_sizes): New function,
replacing scm_fport_buffer_add.
(fport_write, fport_read): Update to let the generic ports code do the
buffering.
(fport_flush, fport_end_input): Remove.
(fport_close): Don't flush in a dynwind; that's the core ports' job.
(scm_make_fptob): Adapt.
* libguile/ioext.c (scm_redirect_port): Adapt to buffering changes.
* libguile/poll.c (scm_primitive_poll): Adapt to buffering changes.
* libguile/ports-internal.h (struct scm_port_internal): Remove
pending_eof flag; this is now set on the read buffer.
* libguile/r6rs-ports.c (struct bytevector_input_port): New type. The
new buffering arrangement means that there's now an intermediate
buffer between the bytevector and the user of the port; this could
lead to a perf degradation, but on the other hand there are some other
speedups enabled by the buffering refactor, so probably the memcpy
cost is dwarfed by the cost of the other parts of the ports
machinery.
(make_bytevector_input_port, bytevector_input_port_read):
(bytevector_input_port_seek, initialize_bytevector_input_ports): Adapt
to new buffering arrangement.
(struct custom_binary_port): Remove read buffer, as Guile handles that
now.
(custom_binary_input_port_setvbuf): Remove; now handled by Guile.
(make_custom_binary_input_port, custom_binary_input_port_read)
(initialize_custom_binary_input_ports): Adapt.
(scm_get_bytevector_some): Adapt to new EOF management.
(scm_t_bytevector_output_port_buffer): Hold on to the underlying port,
so we can flush it if it's open.
(make_bytevector_output_port, bytevector_output_port_write):
(bytevector_output_port_seek): Adapt.
(bytevector_output_port_procedure): Flush the port as appropriate, so
that we get all the bytes.
(make_custom_binary_output_port, custom_binary_output_port_write):
Adapt.
(make_transcoded_port): Don't muck with buffering.
(transcoded_port_write): Simply forward the write to the underlying
port.
(transcoded_port_read): Likewise.
(transcoded_port_close): No need to flush.
(initialize_transcoded_ports): Adapt.
* libguile/read.c (scm_i_scan_for_encoding): Adapt to buffering
changes.
* libguile/rw.c (scm_write_string_partial): Adapt to buffering changes.
* libguile/strports.c: Adapt to the fact that we don't manage the
buffer. Probably room for speed improvements here...
* libguile/vports.c (soft_port_get_natural_buffer_sizes): New function.
Adapt the rest of the file for the new buffering regime.
* test-suite/tests/r6rs-ports.test ("8.2.10 Output ports"): Custom
binary output ports need to be flushed before you can rely on the
write! procedure having been called. Add necessary flush-port
invocations.
("8.2.6 Input and output ports"): Transcoded ports now have an
internal buffer by default. This test checks that the characters are
transcoded one at a time, so to do that, call setvbuf on the
transcoded port to remove the buffer.
* test-suite/tests/web-client.test (run-with-http-transcript): Fix for
different flushing regime on soft ports. (The vestigial flush
procedure is now called after each write, which is not what the test
was expecting.)
* test-suite/standalone/test-scm-c-read.c: Update for changes to the C
interface for defining port types.
* doc/ref/api-io.texi (Ports): Update to discuss buffering in a generic
way, and to remove a hand-wavey paragraph describing string ports as
"interesting and powerful".
(Reading, Writing): Remove placeholder comments. Document
`scm_lfwrite'.
(Buffering): New section.
(File Ports): Link to buffering.
(I/O Extensions): Join subnodes into parent and describe new API,
including buffering API.
* doc/ref/posix.texi (Ports and File Descriptors): Link to buffering.
Remove unread-char etc, as they are documented elsewhere.
(Pipes, Network Sockets and Communication): Link to buffering.
| Andy Wingo | 2016-04-06 | 1 | -6/+6 |
* | Refactor to rw_random / rw_active port flags...* libguile/fports.c (fport_flush, fport_end_input): Move rw_active
handling to ports.c.
* libguile/ioext.c (scm_redirect_port): Use scm_flush_unlocked instead
of calling the flush function directly.
* libguile/ports.c (scm_c_make_port_with_encoding): Ports default to
"rw_random" mode when they have a seek function.
(scm_c_read_unlocked, scm_i_unget_bytes_unlocked)
(scm_slow_get_byte_or_eof_unlocked)
(scm_slow_peek_byte_or_eof_unlocked): Flush write buffer and set
rw_active always in the same way, and only if rw_random is true.
(scm_end_input_unlocked, scm_flush_unlocked): Clear rw_active here
unconditionally.
(scm_c_write_unlocked): Flush read buffer and set rw_active always in
the same way, but only if rw_random is true.
(scm_c_write, scm_lfwrite): Whitespace fixes.
(scm_lfwrite_substr): Don't flush read buffer; lower-level code will
do this.
(scm_truncate_file): Use scm_flush_unlocked instead of calling the
flush function directly.
* libguile/r6rs-ports.c (transcoded_port_flush): Don't muck with
rw_active.
* libguile/read.c (scm_i_scan_for_encoding): Flush write buffer if
needed in same way as ports.c.
* libguile/strports.c (st_end_input): Don't muck with rw_active.
(scm_mkstrport): rw_random defaults to 1 now.
| Andy Wingo | 2016-04-04 | 1 | -4/+5 |
* | Merge commit '5af307de43e4b65eec7f235b48a8908f2a00f134'...Conflicts:
test-suite/tests/reader.test
| Andy Wingo | 2015-01-22 | 1 | -2/+5 |
|\ |
|
| * | read: Accept "\(" in string literals....Suggested by David Kastrup <dak@gnu.org> in <http://bugs.gnu.org/13644>.
* libguile/read.c (scm_read_string_like_syntax): Accept "\(" as
equivalent to "(".
* doc/ref/api-data.texi (String Syntax): Document it.
* test-suite/tests/reader.test ("reading"): Add test.
| Mark H Weaver | 2014-10-01 | 1 | -2/+5 |
* | | maybe_annotate_source does not annotate negative positions...* libguile/read.c (maybe_annotate_source): Don't annotate with negative
lines or columns.
| Andy Wingo | 2014-07-21 | 1 | -0/+5 |
* | | Merge branch 'stable-2.0'...Conflicts:
libguile/read.c
test-suite/tests/web-response.test
| Mark H Weaver | 2014-01-21 | 1 | -8/+24 |
|\| |
|
| * | Arrange so that 'file-encoding' does not truncate the encoding name....Fixes <http://bugs.gnu.org/16463>.
Reported by Sree Harsha Totakura <sreeharsha@totakura.in>.
* libguile/read.c (ENCODING_NAME_MAX_SIZE): New macro.
(SCM_ENCODING_SEARCH_SIZE): Change to 500 + ENCODING_NAME_MAX_SIZE.
(scm_i_scan_for_encoding): Return NULL if there's less than
ENCODING_NAME_MAX_SIZE bytes once "coding: *" has been read.
* test-suite/tests/coding.test ("line
comment")["http://bugs.gnu.org/16463"]: New test.
| Ludovic Courtès | 2014-01-17 | 1 | -7/+23 |
* | | Merge branch 'stable-2.0'...Conflicts:
libguile/print.c
libguile/read.c
test-suite/tests/print.test
| Mark H Weaver | 2014-01-14 | 1 | -6/+34 |
|\| |
|
| * | read: Support R7RS |...| symbol notation....* libguile/private-options.h (SCM_R7RS_SYMBOLS_P): New macro.
(SCM_N_READ_OPTIONS): Increment.
* libguile/read.c (scm_read_opts): Add entry for 'r7rs-symbols'.
(t_read_opts): Add field for 'r7rs_symbols_p'.
(scm_read_string_like_syntax): New function based on earlier
'scm_read_string' that handles either string literals or R7RS quoted
symbols (delimited by vertical bars), depending on the value of 'chr'.
(scm_read_string): Reimplement based on 'scm_read_string_like_syntax'.
(scm_read_r7rs_symbol): New static function.
* doc/ref/api-data.texi (Symbol Read Syntax): Briefly describe the R7RS
symbol syntax, mention the 'r7rs-symbols' read option, and give some
examples.
* doc/ref/api-evaluation.texi (Scheme Read): Mention the 'r7rs-symbols'
read option.
* test-suite/tests/reader.test ("reading"): Add test.
| Mark H Weaver | 2014-01-14 | 1 | -6/+34 |
* | | Merge branch 'stable-2.0'...Conflicts:
libguile/chars.c
libguile/read.c
test-suite/tests/reader.test
| Mark H Weaver | 2014-01-14 | 1 | -3/+46 |
|\| |
|
| * | read: use 'c_tolower' instead of 'tolower' in 'try_read_ci_chars'....* libguile/read.c: Include <c-ctype.h>.
(try_read_ci_chars): Use 'c_tolower' instead of 'tolower'.
| Mark H Weaver | 2014-01-14 | 1 | -1/+2 |
| * | read: Accept "\|" in string literals....* libguile/read.c (scm_read_string): Accept "\|" in string literals.
* doc/ref/api-data.texi (String Syntax): Add "\|" to the list of
supported backslash escapes.
* test-suite/tests/reader.test ("reading"): Add test.
| Mark H Weaver | 2014-01-14 | 1 | -0/+1 |
| * | read: Support R7RS '#true' and '#false' syntax for booleans....* libguile/read.c (try_read_ci_chars): New static function.
(scm_read_boolean, scm_read_array): Use 'try_read_ci_chars'.
* doc/ref/api-data.texi (Booleans): Update docs.
* test-suite/tests/reader.test ("reading"): Add tests.
| Mark H Weaver | 2014-01-14 | 1 | -3/+44 |
* | | Merge branch 'stable-2.0'...Conflicts:
module/system/vm/traps.scm
test-suite/tests/peval.test
| Mark H Weaver | 2014-01-09 | 1 | -0/+3 |
|\| |
|
| * | read: Avoid signed integer overflow in 'read_decimal_integer'....* libguile/read.c (read_decimal_integer): Avoid overflow.
| Mark H Weaver | 2014-01-08 | 1 | -0/+3 |
* | | Thread safe port properties....* libguile/ports.c (scm_i_port_property, scm_i_set_port_property_x):
Lock the port mutex while accessing the port alist.
* libguile/read.c (set_port_read_option): Lock the port mutex
while modifying port read options.
| Mark H Weaver | 2013-12-01 | 1 | -0/+6 |
* | | Merge commit 'a38024baaa32d1a6d91fdc81388c88bbb926c3ae'...Conflicts:
libguile/ports.h
| Andy Wingo | 2013-11-28 | 1 | -13/+10 |
|\| |
|
| * | Make port properties accessible from Scheme....* libguile/ports.c (scm_i_port_alist, scm_i_set_port_alist_x): Removed.
(scm_i_port_property, scm_i_set_port_property_x): New procedures,
available from Scheme as '%port-property' and '%set-port-property!'.
* libguile/ports.h (scm_i_port_alist, scm_i_set_port_alist_x): Removed.
(scm_i_port_property, scm_i_set_port_property_x): New prototypes.
* libguile/read.c (set_port_read_option, init_read_options): Adapt to
use scm_i_port_property and scm_i_set_port_property_x.
| Mark H Weaver | 2013-11-23 | 1 | -13/+10 |
* | | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts:
GUILE-VERSION
libguile/array-map.c
libguile/fports.h
libguile/gc.h
libguile/inline.h
libguile/ports.c
libguile/ports.h
libguile/print.c
libguile/r6rs-ports.c
libguile/read.c
test-suite/tests/00-socket.test
| Mark H Weaver | 2013-04-14 | 1 | -25/+17 |
|\| |
|
| * | Remove byte-order mark check from 'scm_i_scan_for_encoding'....* libguile/read.c (scm_i_scan_for_encoding): Remove byte-order mark
check.
| Mark H Weaver | 2013-04-07 | 1 | -10/+0 |
| * | Use 'c_strcasecmp' instead of 'strcasecmp'....* libguile/ports.c (scm_new_port_table_entry, get_codepoint,
scm_i_set_default_port_encoding, scm_i_port_iconv_descriptors,
scm_i_set_port_encoding_x):
* libguile/print.c (display_string_using_iconv):
* libguile/read.c (scm_i_scan_for_encoding): Use 'c_strcasecmp'.
| Mark H Weaver | 2013-04-05 | 1 | -1/+2 |
| * | Use 'strcasecmp' to compare encoding names....Reported by Ludovic Courtès <ludo@gnu.org>.
* libguile/ports.c (scm_new_port_table_entry,
scm_i_set_default_port_encoding, scm_i_set_port_encoding_x):
libguile/read.c (scm_i_scan_for_encoding): Use 'strcasecmp' to compare
encoding names.
| Mark H Weaver | 2013-04-03 | 1 | -1/+1 |
| * | Move the port alist from the hash table to the internal port structure....* libguile/ports-internal.h (struct scm_port_internal): Add 'alist'
member.
* libguile/ports.c (scm_i_port_alist, scm_i_set_port_alist_x): New
internal functions.
(scm_i_port_weak_hash): Update comment: the hash table is no longer
used to store the port's alist.
(scm_new_port_table_entry): Initialize 'alist'. Store SCM_BOOL_F in
the port weak hash, not SCM_EOL.
* libguile/ports.h (scm_i_port_alist, scm_i_set_port_alist_x): Add
protoypes.
* libguile/read.c (set_port_read_option, init_read_options): Access the
port's alist via 'scm_i_port_alist' and 'scm_i_set_port_alist_x'.
| Mark H Weaver | 2013-04-01 | 1 | -10/+6 |
| * | Revert "detect and consume byte-order marks for textual ports"...This reverts commit b2cb557d75e4daf8c7c8cd43313f4cc51d9a3f1b, which was
pushed accidentally.
| Andy Wingo | 2013-01-30 | 1 | -2/+12 |
| * | detect and consume byte-order marks for textual ports...* libguile/ports.h:
* libguile/ports.c (scm_consume_byte_order_mark): New procedure.
* libguile/fports.c (scm_open_file): Call consume-byte-order-mark if we
are opening a file in "r" mode.
* libguile/read.c (scm_i_scan_for_encoding): Don't do anything about
byte-order marks.
* libguile/load.c (scm_primitive_load): Add a note about the duplicate
encoding scan.
* test-suite/tests/filesys.test: Add tests for UTF-8, UTF-16BE, and
UTF-16LE BOM handling.
| Andy Wingo | 2013-01-30 | 1 | -12/+2 |
* | | Port encodings cannot be NULL...* libguile/ports.c (scm_c_read_unlocked, scm_ungetc_unlocked):
* libguile/read.c (scm_read_character):
* libguile/vports.c (sf_fill_input): Port encodings cannot be NULL any
more, now that encodings are canonicalized, so simplify these.
| Andy Wingo | 2013-01-15 | 1 | -1/+3 |
* | | Port encodings are case-insensitive, but normalized to upper-case....* libguile/ports.c (ascii_toupper, encoding_matches)
(canonicalize_encoding): New helpers.
(scm_c_make_port_with_encoding):
(scm_i_set_default_port_encoding):
(scm_i_set_port_encoding_x): Use the new helpers to be
case-insensitive and also to canonicalize the internal representation
to upper-case ASCII names.
(scm_i_default_port_encoding): Never return NULL.
(scm_port_encoding): The encoding is always a string.
* libguile/read.c (scm_i_scan_for_encoding): Use a locale-independent
check instead of isalnum. Don't upcase the result: the port code will
handle that.
* test-suite/tests/web-response.test ("example-1"): Adapt test to expect
normalized (upper-case) encoding for the response port.
| Andy Wingo | 2013-01-15 | 1 | -6/+11 |