Debian Codegraph @

gcc/testsuite/gm2/isolib/run/pass/arraycons2.mod

raw
1 (* Copyright (C) 2009 Free Software Foundation, Inc. *)
2 (* This file is part of GNU Modula-2.
3
4 GNU Modula-2 is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8
9 GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 for more details.
13
14 You should have received a copy of the GNU General Public License along
15 with gm2; see the file COPYING. If not, write to the Free Software
16 Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *)
17
18 MODULE arraycons2 ;
19
20 FROM StrIO IMPORT WriteString, WriteLn ;
21 FROM StrLib IMPORT StrEqual ;
22 FROM FIO IMPORT StdOut, FlushBuffer ;
23 FROM libc IMPORT exit ;
24
25 (*
26 CONST
27 myconst = sigfigArray{tests{ "12" , "34"},
28 tests{ "56" , "78"}} ;
29 *)
30 TYPE
31 tests = RECORD
32 i, o: ARRAY [0..maxString] OF CHAR ;
33 END ;
34 sigfigArray = ARRAY [0..1] OF tests ;
35
36 CONST
37 maxString = 80 ;
38
39 VAR
40 a: sigfigArray ;
41 e: INTEGER ;
42 t: tests ;
43 BEGIN
44 t := tests{ "01", "02" };
45 (*
46 a := myconst ;
47 e := 0 ;
48 WITH a[0] DO
49 WriteString(i) ;
50 WriteString(' ') ;
51 WriteString(o) ;
52 WriteLn ;
53 IF NOT StrEqual(i, "12")
54 THEN
55 e := 1
56 END ;
57 IF NOT StrEqual(o, "34")
58 THEN
59 e := 1
60 END
61 END ;
62 WriteLn ;
63 WITH a[1] DO
64 WriteString(i) ;
65 WriteString(' ') ;
66 WriteString(o) ;
67 WriteLn ;
68 IF NOT StrEqual(i, "56")
69 THEN
70 e := 1
71 END ;
72 IF NOT StrEqual(o, "78")
73 THEN
74 e := 1
75 END
76 END ;
77 WriteLn ;
78 FlushBuffer(StdOut) ;
79 exit(e)
80 *)
81 END arraycons2.