Debian Codegraph @

gcc/testsuite/gm2/examples/map/pass/testcoor.mod

raw
1 (* Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
2 Free Software Foundation, Inc. *)
3 (* This file is part of GNU Modula-2.
4
5 GNU Modula-2 is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 3, or (at your option) any later
8 version.
9
10 GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 for more details.
14
15 You should have received a copy of the GNU General Public License along
16 with gm2; see the file COPYING. If not, write to the Free Software
17 Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *)
18 MODULE testcoords ;
19
20
21 FROM StrIO IMPORT WriteString, WriteLn ;
22 FROM NumberIO IMPORT WriteCard ;
23 FROM StoreCoords IMPORT InitCoords, KillCoords,
24 AddCoord, GetAndDeleteRandomCoord ;
25
26 VAR
27 Index: CARDINAL ;
28 i, j : CARDINAL ;
29 x, y : CARDINAL ;
30 BEGIN
31 FOR i := 1 TO 10 DO
32 Index := InitCoords() ;
33 WriteString('Index:') ; WriteCard(Index, 4) ; WriteString('Coords') ;
34 FOR j := 1 TO 5 DO
35 AddCoord(Index, j, j)
36 END ;
37 FOR j := 1 TO 6 DO
38 GetAndDeleteRandomCoord(Index, x, y) ;
39 WriteCard(x, 4) ; WriteCard(y, 2)
40 END ;
41 WriteLn ;
42 KillCoords(Index)
43 END
44 END testcoords.