aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.chill/tests1.ch
blob: b6e660f5a5f91006c1a97e4de1156d4f4f8a32f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
-- Copyright (C) 1992, 1995 Free Software Foundation, Inc.

-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
-- 
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
-- 
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

-- Please email any bugs, comments, and/or additions to this file to:
-- bug-gdb@prep.ai.mit.edu

--
-- test program 1 (refer to tests1.exp)
--

/* These functions are defined in libchill.a */

runtime: SPEC MODULE
DCL chill_argc long;
DCL chill_argv REF ARRAY (0:1000) REF CHARS (1000) VARYING;
__print_event: PROC (arg0 ptr,
       arg1 ptr) END;
__print_buffer: PROC (arg0 ptr,
       arg1 ptr) END;
GRANT ALL;
END;

tests1: module;

seize 	__print_event,
	__print_buffer;

newmode	set1 = set(aaa, bbb, ccc);
newmode	nset1 = set(na = 1, nb = 34, nc = 20);
newmode r11 = range (0 : upper(ubyte));
newmode r12 = range (0 : upper(uint));
--newmode r13 = range (0 : upper(ulong)); -- bug in gnuchill
newmode r14 = range (lower(byte) : upper(byte));
newmode r15 = range (lower(int) : upper(int));
newmode r16 = range (lower(long): upper(long));
newmode r2 = set1(bbb : ccc);
newmode r3 = nset1(na : na);
newmode r4 = nset1(nc : nb);
newmode r5 = nset1(lower(nset1) : upper(nset1));

newmode pm1 = powerset set(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
newmode pm2 = powerset byte (1:8);
newmode pm3 = powerset int (-32768:32767);
newmode pm4 = powerset long (-32768:32768);
newmode pm5 = powerset long (lower(long):upper(long));
newmode ref1 = ref pm1;
newmode ref2 = ref byte;
newmode ref3 = ptr;
synmode ref4 = ptr;
synmode syn_int = int;

newmode prm1 = proc ();
newmode prm2 = proc (bool in, int out, long inout) returns (char);
newmode prm3 = proc (pm1, ref1 loc) returns (ref3);
newmode prm4 = proc () exceptions(ex1, ex2, ex3);
newmode prm5 = proc (r11, r16 inout, r5 out) returns (r2) exceptions (ex1);

newmode ev1m = event;
newmode ev2m = event (42);

newmode bu1m = buffer ref1;
newmode bu2m = buffer (42) ubyte;

newmode strm1 = char (5);
synmode strm2 = char (7) varying;

synmode bstr1 = bit(20);
--newmode bstr2 = bit(10) varying;

newmode arr1m = array(1:100) set1;
newmode arr2m = array(1:100, 1:100) set1;
newmode arr3m = array(r11, r12, r14) set1;
newmode arr4m = array(r2) array (r3) array (r4, r5) pm1;
newmode arr5m = array(1:10) int;
newmode arr6m = array(1:5, 1:3, 1:2) long;

newmode stru1m = struct (a, b long, 
			 case b of 
			   (42): ch1 chars(20),
			   (52): ch2 chars(10)
			   else  ch3 chars(1)
  			 esac);

newmode stru2m = struct (f set1,
			 case f of
			    (aaa): ch1 char(20),
			    (bbb): ch2 char(10) varying
			 else	ch3 char(0) varying
			 esac);
newmode stru3m = struct (f r3,
			 case f of
			    (na): ch1 char(20)
			 esac);
newmode stru4m = struct (i long,
			 case of
			   : i1, i11 int,
			     b1 bool,
			     c1 char,
			   : i2, i22 long,
			     bs2 bools (10),
			   :
			     s3 struct (i3 int,
					case of
					  : foo long
					  else bar char
					esac)
			   else
                             x stru2m
                         esac,
                         y stru3m);

synmode m_xyzmode = struct (next ref m_xyzmode,
			    i long);

-- set mode locations
dcl s1l set1 := ccc;
dcl s2l nset1 := nb;

-- range mode locations
dcl rl1 r11 := 3;
dcl rl2 r11 := lower(r11);
dcl rl3 r11 := upper(r11);

dcl rl5 r12 := 65530;
dcl rl6 r12 := lower(r12);
dcl rl7 r12 := upper(r12);

--dcl rl9 r13 := 128;
--dcl rl10 r13 := lower(r13);
--dcl rl11 r13 := upper(r13);

dcl rl13 r14 := -121;
dcl rl14 r14 := lower(r14);
dcl rl15 r14 := upper(r14);

dcl rl17 r15 := -32720;
dcl rl18 r15 := lower(r15);
dcl rl19 r15 := upper(r15);

dcl rl21 r16 := 2147483643;
dcl rl22 r16 := lower(r16);
dcl rl23 r16 := upper(r16);

-- powerset mode locations
dcl pl1 pm1 := [p1:p10];
dcl pl2 pm1 := [];
dcl pl3 pm1 := [p1, p10];
dcl pl4 pm1 := [p1:p2, p4:p6, p8:p10];
dcl pl5 pm1 := [p1:p4, p6, p8:p10];
dcl pl6 pm1 := [p1, p3:p8, p10]; 

dcl pl7 pm2 := [1:8];
dcl pl8 pm3 := [-32768:32767];
--dcl pl9 pm5 := [-2147483648:2147483647];

-- reference mode locations
dcl ref3l ref3;
dcl ref4l ref4;
dcl ref5l, ref6l, ref7l, ref8l ptr;
dcl syn_intl1 syn_int := 42;
dcl intl1 int := -42;

-- synchronization mode locations
dcl ev1l ev1m;
dcl ev2l ev2m;
dcl bu1l bu1m;
dcl bu2l bu2m;

-- timing mode locations
dcl til1 time;

-- string mode locations
dcl strl1, strl2 strm2;
dcl bstrl1 bstr1 := B'10101010101010101010';

-- array mode locations
dcl arrl1 arr1m;
dcl arrl2 arr5m := [1, -1, 32767, -32768, 0, 10, 11, 12, 13, 42];
dcl arrl3 arr6m := [(1:5): [(1:3): [(1:2): -2147483648]]];
dcl arrl4 arr6m := [(1:2): [(1:3): [(1:2): -2147483648]],
		      (3): [(1:3): [(1:2): 100]],
		    (4:5): [(1:3): [(1:2): -2147483648]]];
dcl arrl5 array(1:10) nset1;

-- structure mode locations
dcl strul1 stru1m := [-2147483648, 42, "12345678900987654321"];

dummyfunc: proc();
end dummyfunc;

ref3l:=->pl1;		-- newmode ref
ref4l:=->pl1;		-- synmode ref
ref5l:=->pl1;		-- ptr

ref6l:=->syn_intl1;	-- ref to synmode
ref7l:=->intl1;		-- ref to predefined mode
ref8l:=->pl1;		-- ref to newmode

strl1 := "ha" // C'6e' // "s" // "i" // C'00';
strl2 := C'00' // "ope";

__print_event(addr(ev1l), addr("ev1l"));
__print_event(addr(ev2l), addr("ev2l"));
__print_buffer(addr(bu1l), addr("bu1m"));
__print_buffer(addr(bu2l), addr("bu2m"));

til1 := abstime(1970, 3, 12, 10, 43, 0);
writetext(stdout, "lower(pm3) = %C; upper(pm3) = %C%..%/", 
	          lower(pm3), upper(pm3));
writetext(stdout, "lower(pm5) = %C; upper(pm5) = %C%..%/", 
	          lower(pm5), upper(pm5));
--writetext(stdout, "lower(pl9) = %C; upper(pl9) = %C%..%/", 
--	          lower(pl9), upper(pl9));
writetext(stdout, "date = %C%..%/", til1);

writetext(stdout, "slice1 = %C%..%/", strl1(3 : 5));
writetext(stdout, "slice2 = %C%..%/", strl2(0 : 3));
--writetext(stdout, "slice3 = %C%..%/", strl1(0 up 20));
writetext(stdout, "slice4 = %C%..%/", bstrl1(0));
--writetext(stdout, "slice5 = %C%..%/", arrl3(1:5));


writetext(stdout, "done.%/");

dummyfunc();

end tests1;