I think that in the EOLN function in D2006 (WIN 32) there is an error in applying to Unix line break (LF) text files when this LF is the first character in the input buffer. The source of the error is a string.
TEST [EDX].TTextRec.Mode,tfCRLF
which should read correctly
TEST [EDX].TTextRec.Flags,tfCRLF
The Flags field stores the linear brake style, not the Mode field, which stores the I / O mode.
Above the line is the portion of the fragment below from the Sytem block, which is called when the buffer needs to be replenished. The error goes unnoticed because the Mode field is an odd number for input files (this is the mode in which EOLN is usually used)
fmInput = $D7B1;
only the bit set in tfCRLF (= 1) for Windows created by text files matches. Do later versions of Delphi still have the same encoding for EOLN?
function _Eoln(var t: TTextRec): Boolean; asm . . . @@readChar: PUSH EAX CALL _ReadChar POP EDX CMP AH,cEOF JE @@eof DEC [EDX].TTextRec.BufPos XOR ECX,ECX XCHG ECX,EAX TEST [EDX].TTextRec.Mode,tfCRLF JE @@testLF CMP CL,cCR JE @@eol JMP @@exit @@eol: @@eof: MOV AL,1 @@exit: end;
Another curiosity: this EOLN function, applied to the Windows file type (CRLF), actually checks only CR, as if the LF below is not specified where the (old?) Mac file was installed !?
windows unix delphi
Marcelo bergweiler
source share