/[eiffelstudio]/branches/eth/eve/eweasel/tests/exec021/test.e
ViewVC logotype

Contents of /branches/eth/eve/eweasel/tests/exec021/test.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 83441 - (show annotations)
Sat Jun 5 13:52:53 2010 UTC (9 years, 7 months ago) by jasonw
File size: 1415 byte(s)
Renamed branch eve3 to eve. The eve branch serves as the new branch for the EVE project.
1
2 --| Copyright (c) 1993-2006 University of Southern California and contributors.
3 --| All rights reserved.
4 --| Your use of this work is governed under the terms of the GNU General
5 --| Public License version 2.
6
7 -- To reproduce error:
8 -- Compile class as is. Finish_freezing. Execute `test'.
9 -- Enter large number for cycle length (>= 43664 on my machine).
10 -- Enter 'y' or 'n' in response to "Make cycle" prompt
11 -- (doesn't matter).
12 -- Program dies with `Illegal instruction'.
13
14 class TEST
15
16 creation
17 make, make_obj
18 feature
19
20 make is
21 local
22 last: TEST;
23 length: INTEGER;
24 make_cycle: BOOLEAN;
25 do
26 io.putstring ("Cycle length: ");
27 io.readline;
28 length := io.laststring.to_integer;
29 io.putstring ("Make cycle? (y/n) ");
30 io.readline;
31 last := deep (length, Current);
32 if io.laststring.item (1) = 'Y' or io.laststring.item (1) = 'y' then
33 io.putstring ("Making cycle%N");
34 last.set_next (Current);
35 end;
36 io.putstring ("Calling deep_twin%N");
37 last := deep_twin
38 end;
39
40 make_obj is
41 do
42 end;
43
44 deep (count: INTEGER; obj: TEST): TEST is
45 local
46 k: INTEGER;
47 curr_obj, next_obj: TEST;
48 do
49 from
50 k := 1;
51 curr_obj := obj;
52 until
53 k > count
54 loop
55 !!next_obj.make_obj;
56 curr_obj.set_next (next_obj);
57 curr_obj := next_obj;
58 k := k + 1;
59 end;
60 Result := curr_obj;
61 end;
62
63 set_next (n: TEST) is
64 do
65 next := n;
66 end;
67
68 next: TEST;
69 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23