* EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug #2453)

This commit is contained in:
Tomas Hajny 2005-04-03 21:10:59 +00:00
parent 6bd45d5251
commit d3c103dfd7
14 changed files with 111 additions and 54 deletions

View File

@ -39,6 +39,7 @@ type
const const
LineEnding = #10; LineEnding = #10;
LFNSupport = true; LFNSupport = true;
CtrlZMarksEOF: boolean = false; (* #26 not considered as end of file *)
DirectorySeparator = '/'; DirectorySeparator = '/';
DriveSeparator = ':'; DriveSeparator = ':';
PathSeparator = ';'; PathSeparator = ';';
@ -772,7 +773,10 @@ end.
{ {
$Log$ $Log$
Revision 1.13 2005-02-14 17:13:21 peter Revision 1.14 2005-04-03 21:10:59 hajny
* EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug 2453)
Revision 1.13 2005/02/14 17:13:21 peter
* truncate log * truncate log
} }

View File

@ -45,6 +45,7 @@ const
const const
FileNameCaseSensitive : boolean = true; FileNameCaseSensitive : boolean = true;
CtrlZMarksEOF: boolean = false; (* #26 not considered as end of file *)
sLineBreak : string[1] = LineEnding; sLineBreak : string[1] = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsLF; DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsLF;
@ -348,9 +349,6 @@ end;
Text File Handling Text File Handling
*****************************************************************************} *****************************************************************************}
{ should we consider #26 as the end of a file ? }
{?? $DEFINE EOF_CTRLZ}
{$i text.inc} {$i text.inc}
{***************************************************************************** {*****************************************************************************
@ -549,7 +547,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.21 2005-02-14 17:13:21 peter Revision 1.22 2005-04-03 21:10:59 hajny
* EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug 2453)
Revision 1.21 2005/02/14 17:13:21 peter
* truncate log * truncate log
Revision 1.20 2005/02/01 20:22:49 florian Revision 1.20 2005/02/01 20:22:49 florian

View File

@ -27,8 +27,6 @@ interface
{$l prt1.o} {$l prt1.o}
{$endif} {$endif}
{$DEFINE EOF_CTRLZ}
{$I systemh.inc} {$I systemh.inc}
const const
@ -87,6 +85,7 @@ const UnusedHandle=-1;
LFNSupport: boolean = true; LFNSupport: boolean = true;
FileNameCaseSensitive: boolean = false; FileNameCaseSensitive: boolean = false;
CtrlZMarksEOF: boolean = true; (* #26 is considered as end of file *)
sLineBreak = LineEnding; sLineBreak = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF; DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
@ -592,7 +591,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.34 2005-02-14 17:13:22 peter Revision 1.35 2005-04-03 21:10:59 hajny
* EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug 2453)
Revision 1.34 2005/02/14 17:13:22 peter
* truncate log * truncate log
Revision 1.33 2005/02/06 16:57:18 peter Revision 1.33 2005/02/06 16:57:18 peter

View File

@ -29,8 +29,6 @@ interface
{$define EXCEPTIONS_IN_SYSTEM} {$define EXCEPTIONS_IN_SYSTEM}
{$endif NO_EXCEPTIONS_IN_SYSTEM} {$endif NO_EXCEPTIONS_IN_SYSTEM}
{$DEFINE EOF_CTRLZ}
{ include system-independent routine headers } { include system-independent routine headers }
@ -55,6 +53,7 @@ const
StdErrorHandle = 2; StdErrorHandle = 2;
FileNameCaseSensitive : boolean = false; FileNameCaseSensitive : boolean = false;
CtrlZMarksEOF: boolean = true; (* #26 is considered as end of file *)
sLineBreak = LineEnding; sLineBreak = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF; DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
@ -654,7 +653,10 @@ Begin
End. End.
{ {
$Log$ $Log$
Revision 1.49 2005-02-14 17:13:22 peter Revision 1.50 2005-04-03 21:10:59 hajny
* EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug 2453)
Revision 1.49 2005/02/14 17:13:22 peter
* truncate log * truncate log
Revision 1.48 2005/02/06 16:57:18 peter Revision 1.48 2005/02/06 16:57:18 peter

View File

@ -12,11 +12,6 @@
**********************************************************************} **********************************************************************}
{
Possible Defines:
EOF_CTRLZ Is Ctrl-Z (#26) a EOF mark for textfiles
}
{**************************************************************************** {****************************************************************************
subroutines For TextFile handling subroutines For TextFile handling
@ -257,11 +252,7 @@ Begin
If TextRec(t).BufPos>=TextRec(t).BufEnd Then If TextRec(t).BufPos>=TextRec(t).BufEnd Then
exit(true); exit(true);
end; end;
{$ifdef EOF_CTRLZ} Eof:=CtrlZMarksEOF and (TextRec(t).Bufptr^[TextRec(t).BufPos]=#26);
Eof:=(TextRec(t).Bufptr^[TextRec(t).BufPos]=#26);
{$else}
Eof:=false;
{$endif EOL_CTRLZ}
end; end;
@ -316,13 +307,11 @@ Begin
end; end;
end; end;
case TextRec(t).Bufptr^[TextRec(t).BufPos] of case TextRec(t).Bufptr^[TextRec(t).BufPos] of
{$ifdef EOF_CTRLZ} #26 : if CtrlZMarksEOF then
#26 : begin
begin SeekEof := true;
SeekEof := true; break;
break; end;
end;
{$endif EOF_CTRLZ}
#10,#13, #10,#13,
#9,' ' : ; #9,' ' : ;
else else
@ -378,6 +367,8 @@ Begin
If TextRec(t).BufPos>=TextRec(t).BufEnd Then If TextRec(t).BufPos>=TextRec(t).BufEnd Then
exit(true); exit(true);
end; end;
if CtrlZMarksEOF and (TextRec (T).BufPtr^[TextRec (T).BufPos] = #26) then
exit (true);
Eoln:=(TextRec(t).Bufptr^[TextRec(t).BufPos] in [#10,#13]); Eoln:=(TextRec(t).Bufptr^[TextRec(t).BufPos] in [#10,#13]);
End; End;
@ -408,7 +399,8 @@ Begin
exit(true); exit(true);
end; end;
case TextRec(t).Bufptr^[TextRec(t).BufPos] of case TextRec(t).Bufptr^[TextRec(t).BufPos] of
#26, #26: if CtrlZMarksEOF then
exit (true);
#10,#13 : exit(true); #10,#13 : exit(true);
#9,' ' : ; #9,' ' : ;
else else
@ -763,8 +755,9 @@ End;
Function NextChar(var f:Text;var s:string):Boolean; Function NextChar(var f:Text;var s:string):Boolean;
begin begin
if TextRec(f).BufPos<TextRec(f).BufEnd then if (TextRec(f).BufPos<TextRec(f).BufEnd) then
begin if not (CtrlZMarksEOF) or (TextRec(f).Bufptr^[TextRec(f).BufPos]<>#26) then
begin
if length(s)<high(s) then if length(s)<high(s) then
begin begin
inc(s[0]); inc(s[0]);
@ -793,13 +786,18 @@ begin
{ Return false when already at EOF } { Return false when already at EOF }
if (TextRec(f).BufPos>=TextRec(f).BufEnd) then if (TextRec(f).BufPos>=TextRec(f).BufEnd) then
exit; exit;
while (TextRec(f).Bufptr^[TextRec(f).BufPos] in [#9,#10,#13,' ']) do (* Check performed separately to avoid accessing memory outside buffer *)
if CtrlZMarksEOF and (TextRec(f).Bufptr^[TextRec(f).BufPos]=#26) then
exit;
while (TextRec(f).Bufptr^[TextRec(f).BufPos] <= ' ') do
begin begin
if not NextChar(f,s) then if not NextChar(f,s) then
exit; exit;
{ EOF? } { EOF? }
if (TextRec(f).BufPos>=TextRec(f).BufEnd) then if (TextRec(f).BufPos>=TextRec(f).BufEnd) then
break; break;
if CtrlZMarksEOF and (TextRec(f).Bufptr^[TextRec(f).BufPos]=#26) then
break;
end; end;
IgnoreSpaces:=true; IgnoreSpaces:=true;
end; end;
@ -813,7 +811,7 @@ begin
repeat repeat
if not NextChar(f,s) then if not NextChar(f,s) then
exit; exit;
until (length(s)=high(s)) or (TextRec(f).BufPtr^[TextRec(f).BufPos] in [#9,#10,#13,' ']); until (length(s)=high(s)) or (TextRec(f).BufPtr^[TextRec(f).BufPos] <= ' ');
end; end;
@ -851,6 +849,8 @@ Begin
exit; exit;
end; end;
end; end;
if CtrlZMarksEOF and (TextRec (F).BufPtr^ [TextRec (F).BufPos] = #26) then
Exit;
repeat repeat
prev := TextRec(f).BufPtr^[TextRec(f).BufPos]; prev := TextRec(f).BufPtr^[TextRec(f).BufPos];
inc(TextRec(f).BufPos); inc(TextRec(f).BufPos);
@ -875,6 +875,8 @@ Begin
exit; exit;
end; end;
end; end;
if CtrlZMarksEOF and (TextRec (F).BufPtr^ [TextRec (F).BufPos] = #26) then
Exit;
if (prev=#13) then if (prev=#13) then
{ is there also a #10 after it? } { is there also a #10 after it? }
begin begin
@ -1058,15 +1060,29 @@ Begin
then we return 0 } then we return 0 }
if (TextRec(f).BufPos>=TextRec(f).BufEnd) then if (TextRec(f).BufPos>=TextRec(f).BufEnd) then
exit; exit;
if CtrlZMarksEOF and (TextRec(f).Bufptr^[TextRec(f).BufPos]=#26) then
exit;
ReadNumeric(f,hs); ReadNumeric(f,hs);
end; end;
{$ifdef hascompilerproc} {$ifdef hascompilerproc}
Val(hs,l,code); if (hs = '') then
L := 0
else
begin
Val(hs,l,code);
if Code <> 0 then
InOutRes:=106;
end;
{$else hascompilerproc} {$else hascompilerproc}
Val(hs,fpc_Read_Text_SInt,code); if (hs = '') then
fpc_Read_Text_SInt := 0
else
begin
Val(hs,fpc_Read_Text_SInt,code);
if Code <> 0 then
InOutRes:=106;
end;
{$endif hascompilerproc} {$endif hascompilerproc}
If code<>0 Then
InOutRes:=106;
End; End;
@ -1291,7 +1307,10 @@ end;
{ {
$Log$ $Log$
Revision 1.29 2005-02-14 17:13:29 peter Revision 1.30 2005-04-03 21:10:59 hajny
* EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug 2453)
Revision 1.29 2005/02/14 17:13:29 peter
* truncate log * truncate log
} }

View File

@ -27,6 +27,7 @@ const
DriveSeparator = ':'; DriveSeparator = ':';
PathSeparator = ','; {Is used in MPW and OzTeX} PathSeparator = ','; {Is used in MPW and OzTeX}
FileNameCaseSensitive = false; FileNameCaseSensitive = false;
CtrlZMarksEOF: boolean = false; (* #26 not considered as end of file *)
maxExitCode = 65535; maxExitCode = 65535;
@ -559,7 +560,10 @@ end.
{ {
$Log$ $Log$
Revision 1.31 2005-03-20 19:37:31 olle Revision 1.32 2005-04-03 21:10:59 hajny
* EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug 2453)
Revision 1.31 2005/03/20 19:37:31 olle
+ Added optional path translation mechanism + Added optional path translation mechanism
Revision 1.30 2005/02/14 17:13:30 peter Revision 1.30 2005/02/14 17:13:30 peter

View File

@ -43,6 +43,7 @@ const
StdErrorHandle : LongInt = 0; StdErrorHandle : LongInt = 0;
FileNameCaseSensitive : Boolean = False; FileNameCaseSensitive : Boolean = False;
CtrlZMarksEOF: boolean = false; (* #26 not considered as end of file *)
sLineBreak : string[1] = LineEnding; sLineBreak : string[1] = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsLF; DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsLF;
@ -335,7 +336,10 @@ end.
{ {
$Log$ $Log$
Revision 1.32 2005-02-14 17:13:30 peter Revision 1.33 2005-04-03 21:10:59 hajny
* EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug 2453)
Revision 1.32 2005/02/14 17:13:30 peter
* truncate log * truncate log
Revision 1.31 2005/02/07 21:30:12 peter Revision 1.31 2005/02/07 21:30:12 peter

View File

@ -52,6 +52,7 @@ CONST
StdErrorHandle : THandle = 0; StdErrorHandle : THandle = 0;
FileNameCaseSensitive : boolean = false; FileNameCaseSensitive : boolean = false;
CtrlZMarksEOF: boolean = false; (* #26 not considered as end of file *)
sLineBreak = LineEnding; sLineBreak = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF; DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
@ -488,7 +489,10 @@ Begin
End. End.
{ {
$Log$ $Log$
Revision 1.36 2005-02-14 17:13:30 peter Revision 1.37 2005-04-03 21:10:59 hajny
* EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug 2453)
Revision 1.36 2005/02/14 17:13:30 peter
* truncate log * truncate log
Revision 1.35 2005/02/06 16:57:18 peter Revision 1.35 2005/02/06 16:57:18 peter

View File

@ -58,6 +58,7 @@ CONST
StdErrorHandle : THandle = 0; StdErrorHandle : THandle = 0;
FileNameCaseSensitive : boolean = false; FileNameCaseSensitive : boolean = false;
CtrlZMarksEOF: boolean = false; (* #26 not considered as end of file *)
sLineBreak = LineEnding; sLineBreak = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF; DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
@ -559,7 +560,10 @@ Begin
End. End.
{ {
$Log$ $Log$
Revision 1.14 2005-02-14 17:13:30 peter Revision 1.15 2005-04-03 21:10:59 hajny
* EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug 2453)
Revision 1.14 2005/02/14 17:13:30 peter
* truncate log * truncate log
Revision 1.13 2005/02/06 16:57:18 peter Revision 1.13 2005/02/06 16:57:18 peter

View File

@ -27,8 +27,6 @@ interface
{.$define DEBUGARGUMENTS} {.$define DEBUGARGUMENTS}
{$endif SYSTEMDEBUG} {$endif SYSTEMDEBUG}
{$DEFINE EOF_CTRLZ}
{ $DEFINE OS2EXCEPTIONS} { $DEFINE OS2EXCEPTIONS}
{$I systemh.inc} {$I systemh.inc}
@ -104,6 +102,7 @@ const UnusedHandle=-1;
LFNSupport: boolean = true; LFNSupport: boolean = true;
FileNameCaseSensitive: boolean = false; FileNameCaseSensitive: boolean = false;
CtrlZMarksEOF: boolean = true; (* #26 is considered as end of file *)
sLineBreak = LineEnding; sLineBreak = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF; DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
@ -771,7 +770,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.82 2005-03-27 20:50:35 hajny Revision 1.83 2005-04-03 21:10:59 hajny
* EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug 2453)
Revision 1.82 2005/03/27 20:50:35 hajny
* correction of previous mistyping * correction of previous mistyping
Revision 1.81 2005/03/27 20:40:54 hajny Revision 1.81 2005/03/27 20:40:54 hajny

View File

@ -30,6 +30,7 @@ const
DriveSeparator = ':'; DriveSeparator = ':';
PathSeparator = ';'; PathSeparator = ';';
FileNameCaseSensitive = false; FileNameCaseSensitive = false;
CtrlZMarksEOF: boolean = false; (* #26 not considered as end of file *)
maxExitCode = 255; {$ERROR TODO: CONFIRM THIS} maxExitCode = 255; {$ERROR TODO: CONFIRM THIS}
Type Type
@ -109,7 +110,10 @@ end.
{ {
$Log$ $Log$
Revision 1.7 2005-02-14 17:13:31 peter Revision 1.8 2005-04-03 21:10:59 hajny
* EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug 2453)
Revision 1.7 2005/02/14 17:13:31 peter
* truncate log * truncate log
} }

View File

@ -41,6 +41,7 @@ const
StdErrorHandle = 2; StdErrorHandle = 2;
FileNameCaseSensitive : boolean = true; FileNameCaseSensitive : boolean = true;
CtrlZMarksEOF: boolean = false; (* #26 not considered as end of file *)
sLineBreak = LineEnding; sLineBreak = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsLF; DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsLF;
@ -55,7 +56,10 @@ var argc:longint;external name 'operatingsystem_parameter_argc';
{ {
$Log$ $Log$
Revision 1.25 2005-02-14 17:13:31 peter Revision 1.26 2005-04-03 21:10:59 hajny
* EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug 2453)
Revision 1.25 2005/02/14 17:13:31 peter
* truncate log * truncate log
Revision 1.24 2005/02/14 16:32:41 peter Revision 1.24 2005/02/14 16:32:41 peter

View File

@ -52,6 +52,7 @@ const
StdErrorHandle = 2; StdErrorHandle = 2;
FileNameCaseSensitive : boolean = false; FileNameCaseSensitive : boolean = false;
CtrlZMarksEOF: boolean = true; (* #26 is considered as end of file *)
sLineBreak = LineEnding; sLineBreak = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF; DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
@ -1305,8 +1306,6 @@ end;
Text File Handling Text File Handling
*****************************************************************************} *****************************************************************************}
{$DEFINE EOF_CTRLZ}
{$i text.inc} {$i text.inc}
@ -1541,7 +1540,10 @@ End.
{ {
$Log$ $Log$
Revision 1.20 2005-02-14 17:13:32 peter Revision 1.21 2005-04-03 21:10:59 hajny
* EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug 2453)
Revision 1.20 2005/02/14 17:13:32 peter
* truncate log * truncate log
Revision 1.19 2005/02/01 20:22:50 florian Revision 1.19 2005/02/01 20:22:50 florian

View File

@ -28,9 +28,6 @@ interface
{$define Set_i386_Exception_handler} {$define Set_i386_Exception_handler}
{$endif cpui386} {$endif cpui386}
{ Ctrl-Z means EOF }
{$DEFINE EOF_CTRLZ}
{ include system-independent routine headers } { include system-independent routine headers }
{$I systemh.inc} {$I systemh.inc}
@ -58,6 +55,7 @@ const
StdErrorHandle : THandle = 0; StdErrorHandle : THandle = 0;
FileNameCaseSensitive : boolean = true; FileNameCaseSensitive : boolean = true;
CtrlZMarksEOF: boolean = true; (* #26 not considered as end of file *)
sLineBreak = LineEnding; sLineBreak = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF; DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
@ -1110,7 +1108,10 @@ end.
{ {
$Log$ $Log$
Revision 1.72 2005-03-21 16:31:33 peter Revision 1.73 2005-04-03 21:10:59 hajny
* EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug 2453)
Revision 1.72 2005/03/21 16:31:33 peter
* fix crash under win32 with previous reallocmem fix * fix crash under win32 with previous reallocmem fix
Revision 1.71 2005/03/02 19:18:42 florian Revision 1.71 2005/03/02 19:18:42 florian