/[eiffelstudio]/trunk/eweasel/tests/exec235/test.e
ViewVC logotype

Annotation of /trunk/eweasel/tests/exec235/test.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 103061 - (hide annotations)
Sun Apr 7 06:55:59 2019 UTC (9 months, 1 week ago) by alexk
File size: 2275 byte(s)
Updated ECFs to enable class removal optimization when a test involves finalization.
Updated source code to use contemporary routine type declarations.

1 manus 65296 indexing
2     date: "$Date$"
3     revision: "$Revision$"
4    
5     class
6     TEST
7    
8     inherit
9     LINKED_LIST [STRING]
10     redefine make end
11    
12     create make
13    
14     feature
15    
16     neutral (ni: INTEGER) is do end
17    
18     make is
19     local
20     a1: A [INTEGER]
21     a2: A [STRING]
22     do
23     neutral ($MELT6)
24     create a1
25     io.new_line
26    
27     a1.f1 (1)
28     io.new_line
29     a1.f2 (2)
30     create a2
31     io.new_line
32     a2.f1 ("3")
33     io.new_line
34     a2.f2 ("4")
35    
36     io.new_line
37    
38     a1.receive_f (
39     (agent (i: INTEGER; g: INTEGER): INTEGER
40     do
41     Result := i + g
42     end), 10, 90)
43    
44     a1.receive_p (
45     (agent (i: INTEGER; g: INTEGER)
46     do
47     print ("got: " + i.out + ", " + g.out)
48     end), 10, 90)
49    
50     a2.receive_f (
51     (agent (i: INTEGER; g: STRING): STRING
52     do
53     Result := i.out + g
54     end), 10, "91")
55    
56     a2.receive_p (
57     (agent (i: INTEGER; g: STRING)
58     do
59     print ("got: " + i.out + ", " + g)
60     end), 10, "91")
61    
62     io.new_line
63    
64     receive_a (a2)
65    
66     io.new_line
67    
68     print ("List count: ")
69     print ((agent count).item ([]))
70     io.new_line;
71     extend ("str1")
72     (agent extend).call (["String"])
73     print ("List count2: ")
74     print ((agent count).item ([]))
75     io.new_line
76     gen_caller (["String"], (agent extend))
77     gen_caller ([], agent start)
78     print ((agent item.out).item ([]))
79     io.new_line
80    
81     print (gen_item (["STRING"], agent (s: STRING): STRING do Result := s end))
82    
83     -- To satisfy the postcondition of LINKED_LIST.
84     wipe_out
85     end
86    
87     receive_a (a: A[STRING]) is
88     do
89     print ("receive_a%N")
90     (agent a.receive_p).call(
91     [
92     (agent (i: INTEGER; g: STRING)
93     do
94     print ("got: " + i.out + ", " + g)
95     neutral ($MELT7)
96     end),
97     10, "92"])
98     io.new_line;
99     (agent {A [STRING]}.receive_p).call (
100     [
101     a,
102     (agent (i: INTEGER; g: STRING)
103     do
104     print ("got: " + i.out + ", " + g)
105     neutral ($MELT8)
106     end),
107     10, "92"])
108     end
109    
110 alexk 103061 gen_caller (t: TUPLE; p: PROCEDURE) is
111 manus 65296 local
112 alexk 103061 l_p: PROCEDURE
113 manus 65296 do
114     neutral ($MELT9)
115     l_p := p
116     if l_p.valid_operands (t) then
117     p.call (t)
118     l_p.call (t)
119     end
120     end
121    
122 alexk 103061 gen_item (t: TUPLE; p: FUNCTION [STRING]): STRING is
123 manus 65296 local
124 alexk 103061 l_f: FUNCTION [STRING]
125 manus 65296 do
126     neutral ($MELT10)
127     l_f := p
128     if l_f.valid_operands (t) then
129     p.call (t)
130     Result := p.item (t)
131     end
132     end
133    
134     end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23