Commit | Line | Data |
---|---|---|
f08ff9ca BB |
1 | /****************************************************************************** |
2 | * Copyright (c) 2000-2016 Ericsson Telecom AB | |
3 | * All rights reserved. This program and the accompanying materials | |
4 | * are made available under the terms of the Eclipse Public License v1.0 | |
5 | * which accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
7 | * | |
8 | * Contributors: | |
9 | * | |
10 | * Baranyi, Botond – initial implementation | |
11 | * | |
12 | ******************************************************************************/ | |
13 | ||
14 | #ifndef DEBUGGER_UI_HH | |
15 | #define DEBUGGER_UI_HH | |
16 | ||
17 | /** Command line interface class for the TTCN-3 debugger in single mode | |
18 | * Mimics the functionality of the Main Controller CLI in most cases | |
19 | * Uses the editline package for reading commands (which provides command | |
20 | * completion and command history tracking) */ | |
21 | class TTCN_Debugger_UI { | |
22 | ||
23 | /** structure for storing a command */ | |
24 | struct command_t { | |
25 | /** command name */ | |
26 | const char *name; | |
27 | /** debugger command ID */ | |
28 | int commandID; | |
29 | /** command usage text */ | |
30 | const char *synopsis; | |
31 | /** command description text */ | |
32 | const char *description; | |
33 | }; | |
34 | ||
35 | /** list of commands */ | |
36 | static const command_t debug_command_list[]; | |
37 | ||
38 | /** name of the file, where the command history is stored */ | |
39 | static char* ttcn3_history_filename; | |
40 | ||
41 | /** processes the command in the specified input line | |
42 | * if it's a valid command, then it is added to the command history and | |
43 | * passed to the debugger | |
44 | * if it's not valid, an error message is displayed */ | |
45 | static void process_command(const char* p_line_read); | |
46 | ||
47 | public: | |
48 | ||
49 | /** initializes the UI */ | |
50 | static void init(); | |
51 | ||
52 | /** cleans up the UI's resources */ | |
53 | static void clean_up(); | |
54 | ||
55 | /** reads commands from the standard input and passes them on for processing, | |
56 | * until test execution is no longer halted */ | |
57 | static void read_loop(); | |
58 | ||
59 | /** executes the commands in the specified batch file | |
60 | * each line is treated as a separate command */ | |
61 | static void execute_batch_file(const char* p_file_name); | |
62 | ||
63 | /** prints the specified text to the standard output */ | |
64 | static void print(const char* p_str); | |
65 | ||
66 | /** command completion function for editline */ | |
67 | static char* complete_command(const char* p_prefix, int p_state); | |
68 | }; | |
69 | ||
70 | #endif /* DEBUGGER_UI_HH */ | |
71 |