Compile-time detection of EOL translation mode (CLISP)

Reini Urban rurban@x-ray.at
Tue Jan 30 07:25:00 GMT 2007


Reini Urban schrieb:
> Aaron Brown schrieb:
>> Reini Urban wrote:
>>
>>> Confirmed.
>>> Bug patched at 
>>> http://sourceforge.net/tracker/index.php?func=detail&aid=1633552&group_id=1355&atid=101355 
>>>
>>
>> It's been moved to <http://tinyurl.com/3b3yux> with the
>> following comment from Sam Steingold:
>>
>>> This patch does not seem right.
>>> on linux O_BINARY==0 and I see no reason to default line
>>> termination to :DOS there.
>>> I am rejecting it pending your convincing me that I am
>>> wrong here.
>>
>> To be honest, it didn't seem quite right to me either, but I
>> figured that was down to me not knowing the ins and outs of
>> how Cygwin handles text modes.
>>
>> The original logic was:
>>
>>> #if defined(WIN32) || (defined(UNIX) && (O_BINARY != 0))
>>>  pushSTACK(S(Kdos));           /* :line-terminator */
>>> #else
>>>  pushSTACK(S(Kunix));          /* :line-terminator */
>>
>> which translates to "if O_BINARY is something other than 0,
>> then this unix must differentiate between text and binary
>> streams, so assume that text streams use dos EOLs".  That
>> makes sense, except that O_BINARY is nonzero even on (for
>> instance) my Cygwin installation, where I selected unix EOLs
>> as the default with setup.exe.
>>
>> The patch changes the condition to:
>>
>>> #if defined(WIN32) || (defined(UNIX) && (O_BINARY == 0))
>>
>> which, as Sam pointed out, would make most unixes (on which
>> O_BINARY is 0) use dos EOLs.
> 
> I tought the UNIX O_BINARY logic was only for CYGWIN and wondered what 
> other UNIX that could be.
> Ok, so we'll have to use
> #if defined(WIN32) || \
>   (defined(UNIX) && (O_BINARY != 0) && !defined(__CYGWIN__))
> 
> or make the call slower by doing a dynamic textmount check.
> But I really don't want to do that.

This issue was solved here
https://sourceforge.net/tracker/?func=detail&atid=301355&aid=1633552&group_id=1355
by adding a documentation chapter to clisp's next version:
   http://clisp.podval.org/impnotes/encoding.html#line-term-default

See also:
   http://clisp.cons.org/impnotes/clhs-newline.html
   http://www.unicode.org/reports/tr13/tr13-9.html

The original problem is best solved by a
   (setq *default-file-encoding* :unix)
in ~/.clisprc.lisp
-- 
Reini Urban
http://phpwiki.org/  http://murbreak.at/
http://helsinki.at/  http://spacemovie.mur.at/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list