[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] [PATCH] Restore row and column counting for ports (fix
From: |
Peter Bex |
Subject: |
[Chicken-hackers] [PATCH] Restore row and column counting for ports (fixes #978) |
Date: |
Sat, 16 Feb 2013 15:54:52 +0100 |
User-agent: |
Mutt/1.4.2.3i |
Hi all,
Here are two patches to restore row/column counting in read-line and
read-string, which takes care of #978. This is a cumulative based
on the *fixed* version of read-string (see my previous post to -hackers).
I split up the patches because I'm not 100% sure it's desirable to count
port position in read-string for performance reasons. The original
read-string simply adds the number of read characters to the column,
which will result in bogus line/column counts. It might be preferable
to just not modify the position at all.
Just removing the port position bookkeeping altogether is better, I
think. I haven't done any benchmarks but Chicken's notoriously awful
I/O performance might partially be due to the port position bookkeeping.
If this turns out to be true that this is a big bottleneck, it makes
sense to leave the bookkeeping up to applications. Perhaps it could be
convenient to add a custom "counted port" that can wrap other port
types.
Our current implementation of column counting does not take into account
multibyte UTF-8 characters. I'm not sure if we need to take care of this.
An input file might not be in UTF-8 encoding, in which case "fixing"
UTF-8 counting will cause the count to be incorrect on those files.
We could just assume all ports are UTF-8 since that's the "native"
Chicken character set. The only way to *truly* fix this is to make
ports aware of their encoding, but that's just... annoying :)
Cheers,
Peter
--
http://www.more-magic.net
0001-Restore-row-and-column-number-tracking-in-read-line-.patch
Description: Text document
0002-Also-add-column-row-counting-to-read-line.patch
Description: Text document
- [Chicken-hackers] [PATCH] Restore row and column counting for ports (fixes #978),
Peter Bex <=