guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding new information to scm_t_port (was Re: always O_BINARY?)


From: Mark H Weaver
Subject: Adding new information to scm_t_port (was Re: always O_BINARY?)
Date: Wed, 27 Feb 2013 22:24:19 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

address@hidden (Ludovic Courtès) writes:
> Andy Wingo <address@hidden> skribis:
>
>>   The (newline) function can write CRLF
>>   The ~% format directive should DTRT
>>   read-line should DTRT
>
> IMO the correct abstraction here is transcoders à la R6RS.

Agreed.

> The problem is that scm_t_port doesn’t have any slot to specify the
> EOL style, but it would need one.

I think it's important that we find a way to add new information to
scm_t_port in 2.0.  We also need this to properly fix the BOM issue.

Here's a proposal: let's slightly redefine the meaning of 'input_cd' and
'output_cd'.  Users are already unable to use these, because in the
common case (UTF-8) they are both -1.

Instead of having 'input_cd' and 'output_cd' point directly to the
platform's iconv_t structures, let's have them point to our own internal
structure(s) that hold the needed transcoder state.  This could include
things like the state for internally-implement encoding(s) (e.g. UTF-8
BOM handling), EOL style, and iconv_t pointer(s) if appropriate.

What do you think?

    Mark



reply via email to

[Prev in Thread] Current Thread [Next in Thread]