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
10 * Baranyi, Botond – initial implementation
12 ******************************************************************************/
14 #ifndef DEBUGGER_UI_HH
15 #define DEBUGGER_UI_HH
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 {
23 /** structure for storing a command */
27 /** debugger command ID */
29 /** command usage text */
31 /** command description text */
32 const char *description;
35 /** list of commands */
36 static const command_t debug_command_list[];
38 /** name of the file, where the command history is stored */
39 static char* ttcn3_history_filename;
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);
47 static void help(const char* p_argument);
51 /** initializes the UI */
54 /** cleans up the UI's resources */
55 static void clean_up();
57 /** reads commands from the standard input and passes them on for processing,
58 * until test execution is no longer halted */
59 static void read_loop();
61 /** executes the commands in the specified batch file
62 * each line is treated as a separate command */
63 static void execute_batch_file(const char* p_file_name);
65 /** prints the specified text to the standard output */
66 static void print(const char* p_str);
68 /** command completion function for editline */
69 static char* complete_command(const char* p_prefix, int p_state);
72 #endif /* DEBUGGER_UI_HH */