PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/readline/examples/read_line_test.e

http://github.com/tybor/Liberty
Specman e | 46 lines | 40 code | 6 blank | 0 comment | 4 complexity | 0274fbc2f98514625fdb4cab1b7b593e MD5 | raw file
 1class READ_LINE_TEST
 2
 3inherit
 4   ANY
 5
 6insert
 7   READ_LINE
 8
 9create {ANY}
10   make
11
12feature {ANY}
13   make
14      do
15         prompt := "Liberty> "
16         from
17            read_line
18         until
19            last_line = Void or else last_line.is_empty -- handles Ctrl-D to exit
20         loop
21            if last_line /= Void then
22               if last_line.count > 3 then
23                  print("Adding `")
24                  print(last_line)
25                  print("' to history.%N")
26                  history.add(last_line)
27               else
28                  print("Got `")
29                  print(last_line)
30                  print("'.%N")
31               end
32            end
33            read_line
34         end
35         print("History entries:")
36         history.for_each(agent print_entry(?))
37      end
38
39   print_entry (x: HISTORY_ENTRY)
40      do
41         if x /= Void then
42            print("'" + x.line + "'%N")
43         end
44      end
45
46end -- class READ_LINE_TEST