X-Spam-Check-By: sourceware.org
Message-ID: <6910a60702011154s445f6bcdu97185f2e1b1bdf72@mail.gmail.com>
Date: Thu, 1 Feb 2007 20:54:37 +0100
From: "Reini Urban" <rurban@x-ray.at>
To: cygwin@cygwin.com
Subject: Re: Compile-time detection of EOL translation mode (CLISP)
In-Reply-To: <BAY112-DAV1E8670C1EB6B3ADF196F0C5A60@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
References: <BAY112-DAV120EB321505D27E8138E91C5B80@phx.gbl> 	 <001b01c73033$ee617c20$0708090a@CAM.ARTIMI.COM> 	 <6910a60701090934iff9bd94h3157e3b7d09bb31b@mail.gmail.com> 	 <6910a60701111339g28b22ae7y30077e33709c739e@mail.gmail.com> 	 <BAY112-DAV1ED129EF3FDEDAA51B28AC5A30@phx.gbl> 	 <45BBD6F9.3010704@x-ray.at> <45BEF11A.2030201@x-ray.at> 	 <BAY112-DAV1E8670C1EB6B3ADF196F0C5A60@phx.gbl>
X-Google-Sender-Auth: 493366f197503669
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

2007/1/30, Aaron Brown <arundelo@hotmail.com>:
> Reini Urban (quoting Sam Steingold at the issue tracker
> page [1]) wrote:
>
> > The original problem is best solved by a
> >   (setq *default-file-encoding* :unix)
> > in ~/.clisprc.lisp
>
> As mentioned in an earlier post, that doesn't work for
> *standard-output*, presumably because it's already :dos
> before .clisprc runs.  It would work if there were a way to
> change the external-format of an already-open stream.  Is
> there?

There's a setter, but not easy to find.
> (setf (stream-external-format *standard-output* )
  (make-encoding :line-terminator :unix))
*** - SYSTEM::SET-STREAM-EXTERNAL-FORMAT on #<IO TERMINAL-STREAM> is illegal

You cannot set it on the command-line via "clisp -Efile 1:1 -Eterminal 1:1"
only via the setter. Thanksfully derived streams get it from the parent.

$ clisp -Efile 1:1 -Eterminal 1:1 -q
[1]> *DEFAULT-FILE-ENCODING*
#<ENCODING CHARSET:ISO-8859-1 :DOS>
[2]> *TERMINAL-ENCODING*
#<ENCODING CHARSET:ISO-8859-1 :DOS>
[3]> (stream-external-format *standard-output*)
#<ENCODING CHARSET:ISO-8859-1 :DOS>
[4]> (setf (stream-external-format *standard-output*) (ext:make-encoding :line-
terminator :unix))
*** - SYSTEM::SET-STREAM-EXTERNAL-FORMAT on #<IO TERMINAL-STREAM> is illegal
[5]> (setq *terminal-encoding* (ext:make-encoding :line-terminator :unix))
#<ENCODING CHARSET:ISO-8859-1 :UNIX>
[6]> (stream-external-format *standard-output*)
#<ENCODING CHARSET:ISO-8859-1 :UNIX>
[7]> (system::set-terminal-encoding (ext:make-encoding :line-terminator :unix))
#<ENCODING CHARSET:ISO-8859-1 :UNIX>

The -E arg is only for the charset, not for the line ending. See
encoding_from_name.

> Sam also wrote at the issue tracker page [1]:
>
> > note that even the cygwin CLISP is expected to write files
> > useful for other (non-cygwin) programs, so the fact that
> > they really expect CRLF does matter to us.
>
> Au contraire; speaking for myself, the reason I use Cygwin
> is to avoid (as much as possible) dealing with Windows's
> non-unixy things such as CRLFs.  If I wanted CLISP to act
> like a Windows program rather than a unix program, I would
> use a Windows (non-Cygwin) version of it.

I agree with you. For the reader it is better to detect optional CRLF,
but the stdout *standard-io* and stderr writer *debug-io* should
produce LF only.
Same for the *default-file-encoding*. Esp. annoying since you cannot
set it on the command-line.

> By the way, the cited section of the CLISP implementation
> notes [2] says that defined(WIN32) is true in Cygwin, but it
> isn't.
>
> [1] http://tinyurl.com/3b3yux
> [2] http://clisp.podval.org/impnotes/encoding.html#line-term-default

For me it is true during clisp compilation.
I had to change the patch to fix the WIN32 section,
not the UNIX one. I'll check which optional header defines WIN32.
-- 
Reini Urban
http://phpwiki.org/              http://murbreak.at/
http://spacemovie.mur.at/   http://helsinki.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/

