emacs-devel
[Top][All Lists]
Advanced

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

Re: where to put eol kludge


From: Kenichi Handa
Subject: Re: where to put eol kludge
Date: Fri, 16 May 2003 20:07:47 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.2.92 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

In article <address@hidden>, Thien-Thi Nguyen <address@hidden> writes:
> in any case, it seems to me the criteria for the best place for the
> kludge would be where chunking of the write occurs, since the kludge has
> the re-chunking nature.  which indicates `e_write' after all.  in other
> words, something like:

>   result = encode_coding (...);
>   /* kludge to adjust end of write buffer by way of
>      adjusting coding->produced goes here */
>   if (coding->produced)
>     ...

I'd like to avoid introducing "#ifdef VMS" newly in a
function that doesn't have it currently.

By the way, I've just found this code in sysdep.c.

/*
 *      VAX/VMS VAX C RTL really loses. It insists that records
 *      end with a newline (carriage return) character, and if they
 *      don't it adds one (nice of it isn't it!)
 *
 *      Thus we do this stupidity below.
 */

#undef write
int
sys_write (fildes, buf, nbytes)

Isn't it working?

> if this kludge had more general use, i might even suggest moving it into
> encode_coding for efficiency (i.e., rather than throw away the tail of
> the encoding after eol, add a flag to stop encoding at the "last" eol).
> but on second thought probably determining last eol reliably would not
> preclude processing post-last-eol anyway...

Encoding is not stateless, so, as I wrote before, it's not
easy to rewind the internal encoding state to the point of
last eol.

Anyway, we don't have to throw away the tail bytes of the
encoding after eol even if we do that in e_write.  We can
simply keep those bytes as carryover, move them to the head
of `buf', then, call encode_coding as this:
   encode_coding (coding, addr, buf + CARRY_OVER_BYTES, 
                  nbytes, WRITE_BUF_SIZE - CARRY_OVER_BYTES);
                 
---
Ken'ichi HANDA
address@hidden




reply via email to

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