2
This file is part of the Free Pascal Run time library.
3
Copyright (c) 1999-2000 by the Free Pascal development team
5
See the File COPYING.FPC, included in this distribution,
6
for details about the copyright.
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
**********************************************************************}
14
{****************************************************************************
15
subroutines for typed file handling
16
****************************************************************************}
18
Procedure Assign({$ifdef PARAOUTFILE}out{$else}var{$endif} f:TypedFile;const Name:string);
20
Assign Name to file f so it can be used with the file routines
23
FillChar(f,SizeOF(FileRec),0);
24
FileRec(f).Handle:=UnusedHandle;
25
FileRec(f).mode:=fmClosed;
26
Move(Name[1],FileRec(f).Name,Length(Name));
30
Procedure Assign({$ifdef PARAOUTFILE}out{$else}var{$endif} f:TypedFile;p:pchar);
32
Assign Name to file f so it can be used with the file routines
39
Procedure Assign({$ifdef PARAOUTFILE}out{$else}var{$endif} f:TypedFile;c:char);
41
Assign Name to file f so it can be used with the file routines
48
Procedure fpc_reset_typed(var f : TypedFile;Size : Longint);[Public,IOCheck, Alias:'FPC_RESET_TYPED']; compilerproc;
52
Reset(UnTypedFile(f),Size);
56
Procedure fpc_rewrite_typed(var f : TypedFile;Size : Longint);[Public,IOCheck, Alias:'FPC_REWRITE_TYPED']; compilerproc;
60
Rewrite(UnTypedFile(f),Size);
64
Procedure fpc_typed_write(TypeSize : Longint;var f : TypedFile;const Buf);[IOCheck, Public, Alias :'FPC_TYPED_WRITE']; compilerproc;
68
case fileRec(f).mode of
70
Do_Write(FileRec(f).Handle,@Buf,TypeSize);
71
fmInput: inOutRes := 105;
76
Procedure fpc_typed_read(TypeSize : Longint;var f : TypedFile;out Buf);[IOCheck, Public, Alias :'FPC_TYPED_READ']; compilerproc;
82
case FileRec(f).mode of
85
Result:=Do_Read(FileRec(f).Handle,@Buf,TypeSize);
86
If Result<TypeSize Then
89
fmOutPut: inOutRes := 104