* 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
LineEnding = #10;
LFNSupport = true;
CtrlZMarksEOF: boolean = false; (* #26 not considered as end of file *)
DirectorySeparator = '/';
DriveSeparator = ':';
PathSeparator = ';';
@ -772,7 +773,10 @@ end.
{
$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
}

View File

@ -45,6 +45,7 @@ const
const
FileNameCaseSensitive : boolean = true;
CtrlZMarksEOF: boolean = false; (* #26 not considered as end of file *)
sLineBreak : string[1] = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsLF;
@ -348,9 +349,6 @@ end;
Text File Handling
*****************************************************************************}
{ should we consider #26 as the end of a file ? }
{?? $DEFINE EOF_CTRLZ}
{$i text.inc}
{*****************************************************************************
@ -549,7 +547,10 @@ begin
end.
{
$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
Revision 1.20 2005/02/01 20:22:49 florian

View File

@ -27,8 +27,6 @@ interface
{$l prt1.o}
{$endif}
{$DEFINE EOF_CTRLZ}
{$I systemh.inc}
const
@ -87,6 +85,7 @@ const UnusedHandle=-1;
LFNSupport: boolean = true;
FileNameCaseSensitive: boolean = false;
CtrlZMarksEOF: boolean = true; (* #26 is considered as end of file *)
sLineBreak = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
@ -592,7 +591,10 @@ begin
end.
{
$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
Revision 1.33 2005/02/06 16:57:18 peter

View File

@ -29,8 +29,6 @@ interface
{$define EXCEPTIONS_IN_SYSTEM}
{$endif NO_EXCEPTIONS_IN_SYSTEM}
{$DEFINE EOF_CTRLZ}
{ include system-independent routine headers }
@ -55,6 +53,7 @@ const
StdErrorHandle = 2;
FileNameCaseSensitive : boolean = false;
CtrlZMarksEOF: boolean = true; (* #26 is considered as end of file *)
sLineBreak = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
@ -654,7 +653,10 @@ Begin
End.
{
$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
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
@ -257,11 +252,7 @@ Begin
If TextRec(t).BufPos>=TextRec(t).BufEnd Then
exit(true);
end;
{$ifdef EOF_CTRLZ}
Eof:=(TextRec(t).Bufptr^[TextRec(t).BufPos]=#26);
{$else}
Eof:=false;
{$endif EOL_CTRLZ}
Eof:=CtrlZMarksEOF and (TextRec(t).Bufptr^[TextRec(t).BufPos]=#26);
end;
@ -316,13 +307,11 @@ Begin
end;
end;
case TextRec(t).Bufptr^[TextRec(t).BufPos] of
{$ifdef EOF_CTRLZ}
#26 :
begin
SeekEof := true;
break;
end;
{$endif EOF_CTRLZ}
#26 : if CtrlZMarksEOF then
begin
SeekEof := true;
break;
end;
#10,#13,
#9,' ' : ;
else
@ -378,6 +367,8 @@ Begin
If TextRec(t).BufPos>=TextRec(t).BufEnd Then
exit(true);
end;
if CtrlZMarksEOF and (TextRec (T).BufPtr^[TextRec (T).BufPos] = #26) then
exit (true);
Eoln:=(TextRec(t).Bufptr^[TextRec(t).BufPos] in [#10,#13]);
End;
@ -408,7 +399,8 @@ Begin
exit(true);
end;
case TextRec(t).Bufptr^[TextRec(t).BufPos] of
#26,
#26: if CtrlZMarksEOF then
exit (true);
#10,#13 : exit(true);
#9,' ' : ;
else
@ -763,8 +755,9 @@ End;
Function NextChar(var f:Text;var s:string):Boolean;
begin
if TextRec(f).BufPos<TextRec(f).BufEnd then
begin
if (TextRec(f).BufPos<TextRec(f).BufEnd) then
if not (CtrlZMarksEOF) or (TextRec(f).Bufptr^[TextRec(f).BufPos]<>#26) then
begin
if length(s)<high(s) then
begin
inc(s[0]);
@ -793,13 +786,18 @@ begin
{ Return false when already at EOF }
if (TextRec(f).BufPos>=TextRec(f).BufEnd) then
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
if not NextChar(f,s) then
exit;
{ EOF? }
if (TextRec(f).BufPos>=TextRec(f).BufEnd) then
break;
if CtrlZMarksEOF and (TextRec(f).Bufptr^[TextRec(f).BufPos]=#26) then
break;
end;
IgnoreSpaces:=true;
end;
@ -813,7 +811,7 @@ begin
repeat
if not NextChar(f,s) then
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;
@ -851,6 +849,8 @@ Begin
exit;
end;
end;
if CtrlZMarksEOF and (TextRec (F).BufPtr^ [TextRec (F).BufPos] = #26) then
Exit;
repeat
prev := TextRec(f).BufPtr^[TextRec(f).BufPos];
inc(TextRec(f).BufPos);
@ -875,6 +875,8 @@ Begin
exit;
end;
end;
if CtrlZMarksEOF and (TextRec (F).BufPtr^ [TextRec (F).BufPos] = #26) then
Exit;
if (prev=#13) then
{ is there also a #10 after it? }
begin
@ -1058,15 +1060,29 @@ Begin
then we return 0 }
if (TextRec(f).BufPos>=TextRec(f).BufEnd) then
exit;
if CtrlZMarksEOF and (TextRec(f).Bufptr^[TextRec(f).BufPos]=#26) then
exit;
ReadNumeric(f,hs);
end;
{$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}
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}
If code<>0 Then
InOutRes:=106;
End;
@ -1291,7 +1307,10 @@ end;
{
$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
}

View File

@ -27,6 +27,7 @@ const
DriveSeparator = ':';
PathSeparator = ','; {Is used in MPW and OzTeX}
FileNameCaseSensitive = false;
CtrlZMarksEOF: boolean = false; (* #26 not considered as end of file *)
maxExitCode = 65535;
@ -559,7 +560,10 @@ end.
{
$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
Revision 1.30 2005/02/14 17:13:30 peter

View File

@ -43,6 +43,7 @@ const
StdErrorHandle : LongInt = 0;
FileNameCaseSensitive : Boolean = False;
CtrlZMarksEOF: boolean = false; (* #26 not considered as end of file *)
sLineBreak : string[1] = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsLF;
@ -335,7 +336,10 @@ end.
{
$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
Revision 1.31 2005/02/07 21:30:12 peter

View File

@ -52,6 +52,7 @@ CONST
StdErrorHandle : THandle = 0;
FileNameCaseSensitive : boolean = false;
CtrlZMarksEOF: boolean = false; (* #26 not considered as end of file *)
sLineBreak = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
@ -488,7 +489,10 @@ Begin
End.
{
$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
Revision 1.35 2005/02/06 16:57:18 peter

View File

@ -58,6 +58,7 @@ CONST
StdErrorHandle : THandle = 0;
FileNameCaseSensitive : boolean = false;
CtrlZMarksEOF: boolean = false; (* #26 not considered as end of file *)
sLineBreak = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
@ -559,7 +560,10 @@ Begin
End.
{
$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
Revision 1.13 2005/02/06 16:57:18 peter

View File

@ -27,8 +27,6 @@ interface
{.$define DEBUGARGUMENTS}
{$endif SYSTEMDEBUG}
{$DEFINE EOF_CTRLZ}
{ $DEFINE OS2EXCEPTIONS}
{$I systemh.inc}
@ -104,6 +102,7 @@ const UnusedHandle=-1;
LFNSupport: boolean = true;
FileNameCaseSensitive: boolean = false;
CtrlZMarksEOF: boolean = true; (* #26 is considered as end of file *)
sLineBreak = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
@ -771,7 +770,10 @@ begin
end.
{
$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
Revision 1.81 2005/03/27 20:40:54 hajny

View File

@ -30,6 +30,7 @@ const
DriveSeparator = ':';
PathSeparator = ';';
FileNameCaseSensitive = false;
CtrlZMarksEOF: boolean = false; (* #26 not considered as end of file *)
maxExitCode = 255; {$ERROR TODO: CONFIRM THIS}
Type
@ -109,7 +110,10 @@ end.
{
$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
}

View File

@ -41,6 +41,7 @@ const
StdErrorHandle = 2;
FileNameCaseSensitive : boolean = true;
CtrlZMarksEOF: boolean = false; (* #26 not considered as end of file *)
sLineBreak = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsLF;
@ -55,7 +56,10 @@ var argc:longint;external name 'operatingsystem_parameter_argc';
{
$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
Revision 1.24 2005/02/14 16:32:41 peter

View File

@ -52,6 +52,7 @@ const
StdErrorHandle = 2;
FileNameCaseSensitive : boolean = false;
CtrlZMarksEOF: boolean = true; (* #26 is considered as end of file *)
sLineBreak = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
@ -1305,8 +1306,6 @@ end;
Text File Handling
*****************************************************************************}
{$DEFINE EOF_CTRLZ}
{$i text.inc}
@ -1541,7 +1540,10 @@ End.
{
$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
Revision 1.19 2005/02/01 20:22:50 florian

View File

@ -28,9 +28,6 @@ interface
{$define Set_i386_Exception_handler}
{$endif cpui386}
{ Ctrl-Z means EOF }
{$DEFINE EOF_CTRLZ}
{ include system-independent routine headers }
{$I systemh.inc}
@ -58,6 +55,7 @@ const
StdErrorHandle : THandle = 0;
FileNameCaseSensitive : boolean = true;
CtrlZMarksEOF: boolean = true; (* #26 not considered as end of file *)
sLineBreak = LineEnding;
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
@ -1110,7 +1108,10 @@ end.
{
$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
Revision 1.71 2005/03/02 19:18:42 florian