~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/rtl/inc/typefile.inc

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
    This file is part of the Free Pascal Run time library.
 
3
    Copyright (c) 1999-2000 by the Free Pascal development team
 
4
 
 
5
    See the File COPYING.FPC, included in this distribution,
 
6
    for details about the copyright.
 
7
 
 
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.
 
11
 
 
12
 **********************************************************************}
 
13
 
 
14
{****************************************************************************
 
15
                    subroutines for typed file handling
 
16
****************************************************************************}
 
17
 
 
18
Procedure Assign({$ifdef PARAOUTFILE}out{$else}var{$endif} f:TypedFile;const Name:string);
 
19
{
 
20
  Assign Name to file f so it can be used with the file routines
 
21
}
 
22
Begin
 
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));
 
27
End;
 
28
 
 
29
 
 
30
Procedure Assign({$ifdef PARAOUTFILE}out{$else}var{$endif} f:TypedFile;p:pchar);
 
31
{
 
32
  Assign Name to file f so it can be used with the file routines
 
33
}
 
34
begin
 
35
  Assign(f,StrPas(p));
 
36
end;
 
37
 
 
38
 
 
39
Procedure Assign({$ifdef PARAOUTFILE}out{$else}var{$endif} f:TypedFile;c:char);
 
40
{
 
41
  Assign Name to file f so it can be used with the file routines
 
42
}
 
43
begin
 
44
  Assign(f,string(c));
 
45
end;
 
46
 
 
47
 
 
48
Procedure fpc_reset_typed(var f : TypedFile;Size : Longint);[Public,IOCheck, Alias:'FPC_RESET_TYPED']; compilerproc;
 
49
Begin
 
50
  If InOutRes <> 0 then
 
51
   exit;
 
52
  Reset(UnTypedFile(f),Size);
 
53
End;
 
54
 
 
55
 
 
56
Procedure fpc_rewrite_typed(var f : TypedFile;Size : Longint);[Public,IOCheck, Alias:'FPC_REWRITE_TYPED']; compilerproc;
 
57
Begin
 
58
  If InOutRes <> 0 then
 
59
   exit;
 
60
  Rewrite(UnTypedFile(f),Size);
 
61
End;
 
62
 
 
63
 
 
64
Procedure fpc_typed_write(TypeSize : Longint;var f : TypedFile;const Buf);[IOCheck, Public, Alias :'FPC_TYPED_WRITE']; compilerproc;
 
65
Begin
 
66
  If InOutRes <> 0 then
 
67
   exit;
 
68
  case fileRec(f).mode of
 
69
    fmOutPut,fmInOut:
 
70
      Do_Write(FileRec(f).Handle,@Buf,TypeSize);
 
71
    fmInput: inOutRes := 105;
 
72
    else inOutRes := 103;
 
73
  end;
 
74
End;
 
75
 
 
76
Procedure fpc_typed_read(TypeSize : Longint;var f : TypedFile;out Buf);[IOCheck, Public, Alias :'FPC_TYPED_READ']; compilerproc;
 
77
var
 
78
  Result : Longint;
 
79
Begin
 
80
  If InOutRes <> 0 then
 
81
   exit;
 
82
  case FileRec(f).mode of
 
83
    fmInput,fmInOut:
 
84
      begin
 
85
        Result:=Do_Read(FileRec(f).Handle,@Buf,TypeSize);
 
86
        If Result<TypeSize Then
 
87
         InOutRes:=100
 
88
      end;
 
89
    fmOutPut: inOutRes := 104
 
90
    else inOutRes := 103;
 
91
  end;
 
92
End;
 
93