mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 12:26:58 +02:00
* made generic basic file handling 64 bit
git-svn-id: trunk@1792 -
This commit is contained in:
parent
c43e2df522
commit
4a6939e354
@ -361,13 +361,13 @@ begin
|
||||
BlockWrite(FDataFile, PDDGData(Buffer)^, 1);
|
||||
if DoAppend then
|
||||
begin
|
||||
FIndexList.Add(Pointer(FileSize(FDataFile) - 1));
|
||||
FIndexList.Add(Pointer(PtrInt(FileSize(FDataFile) - 1)));
|
||||
InternalLast;
|
||||
end
|
||||
else begin
|
||||
if FRecordPos = -1 then RecPos := 0
|
||||
else RecPos := FRecordPos;
|
||||
FIndexList.Insert(RecPos, Pointer(FileSize(FDataFile) - 1));
|
||||
FIndexList.Insert(RecPos, Pointer(PtrInt(FileSize(FDataFile) - 1)));
|
||||
end;
|
||||
FIndexList.SaveToFile(FIdxName);
|
||||
end;
|
||||
|
@ -123,7 +123,7 @@ Begin
|
||||
End;
|
||||
|
||||
|
||||
Procedure BlockWrite(Var f:File;Const Buf;Count:Longint;var Result:Longint);[IOCheck];
|
||||
Procedure BlockWrite(Var f:File;Const Buf;Count:Int64;var Result:Int64);[IOCheck];
|
||||
{
|
||||
Write Count records from Buf to file f, return written records in result
|
||||
}
|
||||
@ -141,57 +141,65 @@ Begin
|
||||
End;
|
||||
|
||||
|
||||
Procedure BlockWrite(Var f:File;Const Buf;Count:Longint;var Result:Longint);[IOCheck];
|
||||
{
|
||||
Write Count records from Buf to file f, return written records in result
|
||||
}
|
||||
var
|
||||
l : Int64;
|
||||
Begin
|
||||
BlockWrite(f,Buf,Count,l);
|
||||
Result:=longint(l);
|
||||
End;
|
||||
|
||||
|
||||
Procedure BlockWrite(Var f:File;Const Buf;Count:Word;var Result:Word);[IOCheck];
|
||||
{
|
||||
Write Count records from Buf to file f, return written records in Result
|
||||
}
|
||||
var
|
||||
l : longint;
|
||||
l : Int64;
|
||||
Begin
|
||||
BlockWrite(f,Buf,Count,l);
|
||||
Result:=word(l);
|
||||
End;
|
||||
|
||||
|
||||
Procedure BlockWrite(Var f:File;Const Buf;Count:Cardinal;var Result:Cardinal);[IOCheck];
|
||||
{
|
||||
Write Count records from Buf to file f, return written records in Result
|
||||
}
|
||||
var
|
||||
l : longint;
|
||||
l : Int64;
|
||||
Begin
|
||||
BlockWrite(f,Buf,Count,l);
|
||||
Result:=l;
|
||||
End;
|
||||
|
||||
|
||||
Procedure BlockWrite(Var f:File;Const Buf;Count:Word;var Result:Integer);[IOCheck];
|
||||
{
|
||||
Write Count records from Buf to file f, return written records in Result
|
||||
}
|
||||
var
|
||||
l : longint;
|
||||
l : Int64;
|
||||
Begin
|
||||
BlockWrite(f,Buf,Count,l);
|
||||
Result:=integer(l);
|
||||
End;
|
||||
|
||||
|
||||
Procedure BlockWrite(Var f:File;Const Buf;Count:Longint);[IOCheck];
|
||||
{
|
||||
Write Count records from Buf to file f, if none a Read and Count>0 then
|
||||
InOutRes is set
|
||||
}
|
||||
var
|
||||
Result : Longint;
|
||||
Result : Int64;
|
||||
Begin
|
||||
BlockWrite(f,Buf,Count,Result);
|
||||
If (InOutRes=0) and (Result<Count) and (Count>0) Then
|
||||
InOutRes:=101;
|
||||
End;
|
||||
|
||||
|
||||
Procedure BlockRead(var f:File;var Buf;Count:Longint;var Result:Longint);[IOCheck];
|
||||
Procedure BlockRead(var f:File;var Buf;Count:Int64;var Result:Int64);[IOCheck];
|
||||
{
|
||||
Read Count records from file f ro Buf, return number of read records in
|
||||
Result
|
||||
@ -209,6 +217,17 @@ Begin
|
||||
end;
|
||||
End;
|
||||
|
||||
Procedure BlockRead(var f:File;var Buf;Count:Longint;var Result:Longint);[IOCheck];
|
||||
{
|
||||
Read Count records from file f ro Buf, return number of read records in
|
||||
Result
|
||||
}
|
||||
var
|
||||
l : int64;
|
||||
Begin
|
||||
BlockRead(f,Buf,Count,l);
|
||||
Result:=longint(l);
|
||||
End;
|
||||
|
||||
Procedure BlockRead(var f:File;var Buf;count:Word;var Result:Word);[IOCheck];
|
||||
{
|
||||
@ -216,46 +235,43 @@ Procedure BlockRead(var f:File;var Buf;count:Word;var Result:Word);[IOCheck];
|
||||
Result
|
||||
}
|
||||
var
|
||||
l : longint;
|
||||
l : int64;
|
||||
Begin
|
||||
BlockRead(f,Buf,Count,l);
|
||||
Result:=word(l);
|
||||
End;
|
||||
|
||||
|
||||
Procedure BlockRead(var f:File;var Buf;count:Cardinal;var Result:Cardinal);[IOCheck];
|
||||
{
|
||||
Read Count records from file f to Buf, return number of read records in
|
||||
Result
|
||||
}
|
||||
var
|
||||
l : longint;
|
||||
l : int64;
|
||||
Begin
|
||||
BlockRead(f,Buf,Count,l);
|
||||
Result:=l;
|
||||
End;
|
||||
|
||||
|
||||
Procedure BlockRead(var f:File;var Buf;count:Word;var Result:Integer);[IOCheck];
|
||||
{
|
||||
Read Count records from file f to Buf, return number of read records in
|
||||
Result
|
||||
}
|
||||
var
|
||||
l : longint;
|
||||
l : int64;
|
||||
Begin
|
||||
BlockRead(f,Buf,Count,l);
|
||||
Result:=integer(l);
|
||||
End;
|
||||
|
||||
|
||||
Procedure BlockRead(Var f:File;Var Buf;Count:Longint);[IOCheck];
|
||||
Procedure BlockRead(Var f:File;Var Buf;Count:Int64);[IOCheck];
|
||||
{
|
||||
Read Count records from file f to Buf, if none are read and Count>0 then
|
||||
InOutRes is set
|
||||
}
|
||||
var
|
||||
Result : Longint;
|
||||
Result : int64;
|
||||
Begin
|
||||
BlockRead(f,Buf,Count,Result);
|
||||
If (InOutRes=0) and (Result<Count) and (Count>0) Then
|
||||
@ -263,7 +279,7 @@ Begin
|
||||
End;
|
||||
|
||||
|
||||
Function FilePos(var f:File):Longint;[IOCheck];
|
||||
Function FilePos(var f:File):Int64;[IOCheck];
|
||||
{
|
||||
Return current Position In file f in records
|
||||
}
|
||||
@ -280,7 +296,7 @@ Begin
|
||||
End;
|
||||
|
||||
|
||||
Function FileSize(var f:File):Longint;[IOCheck];
|
||||
Function FileSize(var f:File):Int64;[IOCheck];
|
||||
{
|
||||
Return the size of file f in records
|
||||
}
|
||||
@ -315,7 +331,7 @@ Begin
|
||||
End;
|
||||
|
||||
|
||||
Procedure Seek(var f:File;Pos:Longint);[IOCheck];
|
||||
Procedure Seek(var f:File;Pos:Int64);[IOCheck];
|
||||
{
|
||||
Goto record Pos in file f
|
||||
}
|
||||
@ -329,7 +345,6 @@ Begin
|
||||
end;
|
||||
End;
|
||||
|
||||
|
||||
Procedure Truncate(Var f:File);[IOCheck];
|
||||
{
|
||||
Truncate/Cut file f at the current record Position
|
||||
|
@ -511,19 +511,21 @@ Procedure Rewrite(Var f:File);
|
||||
Procedure Reset(Var f:File;l:Longint);
|
||||
Procedure Reset(Var f:File);
|
||||
Procedure Close(Var f:File);
|
||||
Procedure BlockWrite(Var f:File;Const Buf;Count:Int64;Var Result:Int64);
|
||||
Procedure BlockWrite(Var f:File;Const Buf;Count:Longint;Var Result:Longint);
|
||||
Procedure BlockWrite(Var f:File;Const Buf;Count:Cardinal;var Result:Cardinal);
|
||||
Procedure BlockWrite(Var f:File;Const Buf;Count:Word;Var Result:Word);
|
||||
Procedure BlockWrite(Var f:File;Const Buf;Count:Word;Var Result:Integer);
|
||||
Procedure BlockWrite(Var f:File;Const Buf;Count:Longint);
|
||||
Procedure BlockRead(Var f:File;Var Buf;count:Int64;Var Result:Int64);
|
||||
Procedure BlockRead(Var f:File;Var Buf;count:Longint;Var Result:Longint);
|
||||
Procedure BlockRead(Var f:File;Var Buf;count:Cardinal;Var Result:Cardinal);
|
||||
Procedure BlockRead(Var f:File;Var Buf;count:Word;Var Result:Word);
|
||||
Procedure BlockRead(Var f:File;Var Buf;count:Word;Var Result:Integer);
|
||||
Procedure BlockRead(Var f:File;Var Buf;count:Longint);
|
||||
Function FilePos(Var f:File):Longint;
|
||||
Function FileSize(Var f:File):Longint;
|
||||
Procedure Seek(Var f:File;Pos:Longint);
|
||||
Procedure BlockRead(Var f:File;Var Buf;count:Int64);
|
||||
Function FilePos(Var f:File):Int64;
|
||||
Function FileSize(Var f:File):Int64;
|
||||
Procedure Seek(Var f:File;Pos:Int64);
|
||||
Function EOF(Var f:File):Boolean;
|
||||
Procedure Erase(Var f:File);
|
||||
Procedure Rename(Var f:File;const s:string);
|
||||
|
@ -85,7 +85,7 @@ Begin
|
||||
tlbsLF: TextRec(t).LineEnd := #10;
|
||||
tlbsCRLF: TextRec(t).LineEnd := #13#10;
|
||||
tlbsCR: TextRec(t).LineEnd := #13;
|
||||
End;
|
||||
End;
|
||||
Move(s[1],TextRec(t).Name,Length(s));
|
||||
End;
|
||||
|
||||
@ -267,7 +267,9 @@ End;
|
||||
|
||||
Function SeekEof (Var t : Text) : Boolean;
|
||||
var
|
||||
oldfilepos, oldbufpos, oldbufend, reads: longint;
|
||||
oldfilepos : Int64;
|
||||
oldbufpos, oldbufend : SizeInt;
|
||||
reads: longint;
|
||||
isdevice: boolean;
|
||||
Begin
|
||||
If (InOutRes<>0) then
|
||||
@ -310,13 +312,14 @@ Begin
|
||||
end;
|
||||
end;
|
||||
case TextRec(t).Bufptr^[TextRec(t).BufPos] of
|
||||
#26 : if CtrlZMarksEOF then
|
||||
begin
|
||||
SeekEof := true;
|
||||
break;
|
||||
end;
|
||||
#10,#13,
|
||||
#9,' ' : ;
|
||||
#26 :
|
||||
if CtrlZMarksEOF then
|
||||
begin
|
||||
SeekEof := true;
|
||||
break;
|
||||
end;
|
||||
#10,#13,#9,' ' :
|
||||
;
|
||||
else
|
||||
begin
|
||||
SeekEof := false;
|
||||
@ -420,8 +423,7 @@ Begin
|
||||
End;
|
||||
|
||||
|
||||
|
||||
Procedure SetTextBuf(Var F : Text; Var Buf; Size : Longint);
|
||||
Procedure SetTextBuf(Var F : Text; Var Buf; Size : SizeInt);
|
||||
Begin
|
||||
TextRec(f).BufPtr:=@Buf;
|
||||
TextRec(f).BufSize:=Size;
|
||||
@ -451,11 +453,11 @@ end;
|
||||
Write(Ln)
|
||||
*****************************************************************************}
|
||||
|
||||
Procedure fpc_WriteBuffer(var f:Text;const b;len:longint);[Public,Alias:'FPC_WRITEBUFFER'];
|
||||
Procedure fpc_WriteBuffer(var f:Text;const b;len:SizeInt);[Public,Alias:'FPC_WRITEBUFFER'];
|
||||
var
|
||||
p : pchar;
|
||||
left,
|
||||
idx : longint;
|
||||
idx : SizeInt;
|
||||
begin
|
||||
p:=pchar(@b);
|
||||
idx:=0;
|
||||
@ -536,7 +538,6 @@ End;
|
||||
{ provide local access to write_str }
|
||||
procedure Write_Str(Len : Longint;var f : Text;const s : String); iocheck; [external name 'FPC_WRITE_TEXT_SHORTSTR'];
|
||||
|
||||
|
||||
Procedure fpc_Write_Text_Pchar_as_Array(Len : Longint;var f : Text;const s : array of char); iocheck; [Public,Alias:'FPC_WRITE_TEXT_PCHAR_AS_ARRAY']; compilerproc;
|
||||
var
|
||||
ArrayLen : longint;
|
||||
@ -630,6 +631,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
Procedure fpc_Write_Text_SInt(Len : Longint;var t : Text;l : ValSInt); iocheck; [Public,Alias:'FPC_WRITE_TEXT_SINT']; compilerproc;
|
||||
var
|
||||
s : String;
|
||||
@ -958,7 +960,7 @@ End;
|
||||
|
||||
Procedure fpc_Read_Text_AnsiStr(var f : Text;out s : AnsiString); iocheck; [Public,Alias:'FPC_READ_TEXT_ANSISTR']; compilerproc;
|
||||
var
|
||||
slen,len : longint;
|
||||
slen,len : SizeInt;
|
||||
Begin
|
||||
slen:=0;
|
||||
Repeat
|
||||
|
Loading…
Reference in New Issue
Block a user