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[]; | |
5ea46818 BB |
37 | |
38 | #ifdef ADVANCED_DEBUGGER_UI | |
f08ff9ca BB |
39 | /** name of the file, where the command history is stored */ |
40 | static char* ttcn3_history_filename; | |
5ea46818 | 41 | #endif |
f08ff9ca BB |
42 | |
43 | /** processes the command in the specified input line | |
44 | * if it's a valid command, then it is added to the command history and | |
45 | * passed to the debugger | |
46 | * if it's not valid, an error message is displayed */ | |
47 | static void process_command(const char* p_line_read); | |
48 | ||
5ea46818 | 49 | /** displays help for the specified command, or lists available commands */ |
f57971fe BB |
50 | static void help(const char* p_argument); |
51 | ||
f08ff9ca BB |
52 | public: |
53 | ||
54 | /** initializes the UI */ | |
55 | static void init(); | |
56 | ||
57 | /** cleans up the UI's resources */ | |
58 | static void clean_up(); | |
59 | ||
60 | /** reads commands from the standard input and passes them on for processing, | |
61 | * until test execution is no longer halted */ | |
62 | static void read_loop(); | |
63 | ||
64 | /** executes the commands in the specified batch file | |
65 | * each line is treated as a separate command */ | |
66 | static void execute_batch_file(const char* p_file_name); | |
67 | ||
68 | /** prints the specified text to the standard output */ | |
69 | static void print(const char* p_str); | |
70 | ||
5ea46818 | 71 | #ifdef ADVANCED_DEBUGGER_UI |
f08ff9ca BB |
72 | /** command completion function for editline */ |
73 | static char* complete_command(const char* p_prefix, int p_state); | |
5ea46818 | 74 | #endif |
f08ff9ca BB |
75 | }; |
76 | ||
77 | #endif /* DEBUGGER_UI_HH */ | |
78 |