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

« back to all changes in this revision

Viewing changes to fpcsrc/utils/fpmc/readmsg.pp

  • 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
    reads and dumps a message file to screen.
 
6
 
 
7
    See the file COPYING.FPC, included in this distribution,
 
8
    for details about the copyright.
 
9
 
 
10
    This program is distributed in the hope that it will be useful,
 
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
13
 
 
14
 **********************************************************************}
 
15
{$mode objfpc}
 
16
{$h+}
 
17
program readmsg;
 
18
 
 
19
Type
 
20
  PCardinal = ^Cardinal;
 
21
 
 
22
Var
 
23
  F : File of Cardinal;
 
24
  PO,PI : PCardinal;
 
25
  I,J,Count,C,S : Cardinal;
 
26
  Buf : String;
 
27
 
 
28
begin
 
29
  Assign(F,Paramstr(1));
 
30
  Reset(F);
 
31
  Read(F,Count);
 
32
  Writeln('Message count: ',Count);
 
33
  S:=SizeOf(Cardinal)*Count+1;
 
34
  GetMem(PO,S);
 
35
  GetMem(PI,S);
 
36
  FillChar(PI^,S,0);
 
37
  FillChar(PO^,S,0);
 
38
  For I:=1 to Count do
 
39
    begin
 
40
    Read(F,C);
 
41
    PI[I]:=C;
 
42
    Read(F,C);
 
43
    If (C<>PI[I]) then
 
44
      Writeln('Error in ID: ',C,'<>ID',PI[I])
 
45
    else
 
46
      Writeln('Found ID ',C);
 
47
    Read(F,C);
 
48
    PO[I]:=C;
 
49
    Writeln('Found offset : ',C);
 
50
    end;
 
51
  For I:=1 to Count do
 
52
    begin
 
53
    Seek(F,PO[I] div 4);
 
54
    Read(F,S);
 
55
    Writeln('Found offset ',S,' at item ',i,' offset ',PO[I]);
 
56
    For J:=1 to (S div 4)-1 do
 
57
      begin
 
58
      Read(F,C);
 
59
      Move(C,Buf[J*4-3],4);
 
60
      end;
 
61
    J:=S-4;
 
62
    While Buf[J]=#0 do
 
63
      dec(J);
 
64
    SetLength(Buf,J);
 
65
    Writeln('String (',J,') : ',Buf);
 
66
    end;
 
67
  Writeln('Seqential read : ');
 
68
  Seek(F,PO[1] div 4);
 
69
  For I:=1 to Count do
 
70
    begin
 
71
    Read(F,S);
 
72
    Writeln('Found offset ',S,' at item ',i,' offset ',FilePos(F));
 
73
    For J:=1 to (S div 4)-1 do
 
74
      begin
 
75
      Read(F,C);
 
76
      Move(C,Buf[J*4-3],4);
 
77
      end;
 
78
    J:=S-4;
 
79
    While Buf[J]=#0 do
 
80
      dec(J);
 
81
    SetLength(Buf,J);
 
82
    Writeln('String (',J,') : ',Buf);
 
83
    end;
 
84
  Close(F);
 
85
end.