~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to docs/objectex/ex25.pp

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Program ex21;
2
 
 
3
 
{ Program to demonstrate the TCollection.Foreach method }
4
 
 
5
 
Uses Objects,MyObject; { For TMyObject definition and registration }
6
 
 
7
 
Var C : PCollection;
8
 
    M : PMyObject;
9
 
    I : Longint;
10
 
 
11
 
Function CheckField (Dummy: Pointer;P : PMyObject) : Longint;
12
 
 
13
 
begin
14
 
  If P^.GetField<56 then
15
 
    Checkfield:=1
16
 
  else
17
 
    CheckField:=0;
18
 
end;
19
 
 
20
 
begin
21
 
  C:=New(PCollection,Init(100,10));
22
 
  For I:=1 to 100 do
23
 
    begin
24
 
    M:=New(PMyObject,Init);
25
 
    M^.SetField(I);
26
 
    C^.Insert(M);
27
 
    end;
28
 
  Writeln ('Inserted ',C^.Count,' objects');
29
 
  Writeln ('Last one for which Field<56  has index (should be 54) : ',
30
 
            C^.IndexOf(C^.LastThat(@CheckField)));
31
 
  C^.FreeAll;
32
 
  Dispose(C,Done);
33
 
end.
 
 
b'\\ No newline at end of file'