[Python-Dev] RE: [Patches] [Patch #102915] xreadlines : readlines :: xrange : range
Tim Peters
tim.one@home.com
Tue, 2 Jan 2001 17:00:37 -0500
[Guido]
> Quite apart from whether we should enable xreadlines(), could you look
> into doing a similar thing for MSVC stdio? For most Unix platforms, a
> cop-out answer is "use glibc" -- but for Windows it may pay to do our
> own hack.
There's no question about whether it would pay on Windows, because it pays
big for Perl on Windows. The question is about cost. There's no way to
*do* it short of the way Perl does it, which is to write a large pile of
Windows-specific code (roughly the same size and complexity as the glibc
getline implementation -- check it out, it's not trivial, and glibc exploits
compiler inlining to make it bearable) relying on reverse-engineered
accidents of how MS happens to use all the fields from this undocumented
struct (from MS's stdio.h):
struct _iobuf {
char *_ptr;
int _cnt;
char *_base;
int _flag;
int _file;
int _charbuf;
int _bufsiz;
char *_tmpfname;
};
typedef struct _iobuf FILE;
in their stdio implementation. Else it won't play correctly with MS's
stdio. That's A Project. Last year I tried extracting the relevant code
from Perl, but, as is usual, gave up after unraveling the third (whatever)
layer of mystery macros with no end in sight. I bet it would take me a
week. Is it worth that much to you and DC? Since the real Windows experts
are hanging out at ActiveState, I bet one of them will volunteer to do it
tonight <wink>.