1
/* This file is part of Malaga, a system for Natural Language Analysis.
2
* Copyright (C) 1995-1999 Bjoern Beutel
5
* Universitaet Erlangen-Nuernberg
6
* Abteilung fuer Computerlinguistik
9
* e-mail: malaga@linguistik.uni-erlangen.de
11
* This program is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 2 of the License, or
14
* (at your option) any later version.
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
21
* You should have received a copy of the GNU General Public License
22
* along with this program; if not, write to the Free Software
23
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
25
/* description ==============================================================*/
27
/* Tools for a command line interpreter. */
29
/* types ====================================================================*/
31
/* Use a vector of "command_t" command descriptions
32
* (terminated by a {NULL, NULL} entry) as argument for "command_loop". */
35
string_t names; /* the command name followed by its
36
* shortcuts, separated by spaces */
37
void (*command) (string_t arguments); /* the command function */
38
string_t help; /* help string or NULL */
41
/* variables ================================================================*/
43
GLOBAL jmp_buf *error_jump_point; /* the current return point after an error */
45
GLOBAL command_t **options;
46
/* The options that can be set by the set command.
47
* This has to be set before executing "set_command". */
49
GLOBAL bool_t quit_requested; /* TRUE if quit command has been executed */
50
GLOBAL bool_t leave_command_loop; /* set to TRUE if command loop is to leave */
52
/* functions for user interrupts ============================================*/
54
extern void check_user_break (void);
55
/* Abort command execution if user has sent an interrupt signal. */
57
/* functions for reading and executing commands =============================*/
59
extern void execute_command_file (string_t command_file, string_t line_header,
60
command_t *commands[]);
61
/* Execute commands in <command_file> using <commands>.
62
* If <line_header> != NULL, command lines must start with <line_header>. */
64
extern void command_loop (string_t prompt, command_t *commands[]);
65
/* Read user commands, look for them in <commands> and execute them
66
* until a command returns FALSE. */
68
extern void execute_set_commands (string_t file_name, string_t prefix);
69
/* Execute set commands in file <file_name> that are prefixed with <prefix>. */
71
/* general commands =========================================================*/
73
extern command_t help_command; /* Print a command summary. */
75
extern command_t quit_command; /* Quit the program. */
77
extern command_t get_command; /* Query options. */
79
extern command_t set_command; /* Set options. */
81
extern command_t alias_option; /* Define command line abbreviations. */
83
/* end of file ==============================================================*/