1 /* Header file for simulator argument handling.
2 Copyright (C) 1997 Free Software Foundation, Inc.
3 Contributed by Cygnus Support.
5 This file is part of GDB, the GNU debugger.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License along
18 with this program; if not, write to the Free Software Foundation, Inc.,
19 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
26 /* ARGV option support.
28 Options for the standalone simulator are parsed by sim_open since
29 sim_open handles the large majority of them and it also parses the
30 options when invoked by gdb [or any external program].
32 Per getopt: arg#2 is the option index; arg#3 is the option's
33 argument, NULL if optional and missing. */
35 typedef SIM_RC (OPTION_HANDLER
) PARAMS ((SIM_DESC
, int, char *));
37 /* Declare option handlers with a macro so it's usable on k&r systems. */
38 #define DECLARE_OPTION_HANDLER(fn) SIM_RC fn PARAMS ((SIM_DESC, int, char *))
41 /* The long option information. */
43 /* The short option with the same meaning ('\0' if none). */
45 /* The name of the argument (NULL if none). */
47 /* The documentation string. If this is NULL, this is a synonym for
48 the previous option. */
50 /* A function to process the option. */
51 OPTION_HANDLER
*handler
;
54 /* All options that don't have a short form equivalent begin with this for
55 `val'. 130 isn't special, just some non-ASCII value to begin at.
56 Modules needn't worry about collisions here, the code dynamically assigned
57 the actual numbers used and then passes the original value to the option
59 #define OPTION_START 130
61 /* Non-zero if an option whose `val' entry is O is using OPTION_START. */
62 #define OPTION_LONG_ONLY_P(o) ((unsigned char) (o) >= OPTION_START)
64 /* List of options added by various modules. */
65 typedef struct option_list
{
66 struct option_list
*next
;
67 const OPTION
*options
;
70 /* Add a set of options to the simulator.
71 TABLE is an array of OPTIONS terminated by a NULL `opt.name' entry. */
72 SIM_RC sim_add_option_table
PARAMS ((SIM_DESC sd
, const OPTION
*table
));
74 /* Install handler for the standard options. */
75 MODULE_INSTALL_FN standard_install
;
77 /* Called by sim_open to parse the arguments. */
78 SIM_RC sim_parse_args
PARAMS ((SIM_DESC sd
, char **argv
));
80 /* Print help messages for the options. */
81 void sim_print_help
PARAMS ((SIM_DESC sd
));
83 /* Try to parse the command as if it is an option, Only fail when
84 totally unsuccessful */
85 SIM_RC sim_args_command
PARAMS ((SIM_DESC sd
, char *cmd
));
87 #endif /* SIM_OPTIONS_H */