198944Sobrien/* MI Command Set - MI Command Parser.
298944Sobrien   Copyright 2000 Free Software Foundation, Inc.
398944Sobrien   Contributed by Cygnus Solutions (a Red Hat company).
498944Sobrien
598944Sobrien   This file is part of GDB.
698944Sobrien
798944Sobrien   This program is free software; you can redistribute it and/or modify
898944Sobrien   it under the terms of the GNU General Public License as published by
998944Sobrien   the Free Software Foundation; either version 2 of the License, or
1098944Sobrien   (at your option) any later version.
1198944Sobrien
1298944Sobrien   This program is distributed in the hope that it will be useful,
1398944Sobrien   but WITHOUT ANY WARRANTY; without even the implied warranty of
1498944Sobrien   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1598944Sobrien   GNU General Public License for more details.
1698944Sobrien
1798944Sobrien   You should have received a copy of the GNU General Public License
1898944Sobrien   along with this program; if not, write to the Free Software
1998944Sobrien   Foundation, Inc., 59 Temple Place - Suite 330,
2098944Sobrien   Boston, MA 02111-1307, USA.  */
2198944Sobrien
2298944Sobrien#ifndef MI_PARSE_H
2398944Sobrien#define MI_PARSE_H
2498944Sobrien
2598944Sobrien/* MI parser */
2698944Sobrien
2798944Sobrienenum mi_command_type
2898944Sobrien  {
2998944Sobrien    MI_COMMAND, CLI_COMMAND
3098944Sobrien  };
3198944Sobrien
3298944Sobrienstruct mi_parse
3398944Sobrien  {
3498944Sobrien    enum mi_command_type op;
3598944Sobrien    char *command;
3698944Sobrien    char *token;
3798944Sobrien    const struct mi_cmd *cmd;
3898944Sobrien    char *args;
3998944Sobrien    char **argv;
4098944Sobrien    int argc;
4198944Sobrien  };
4298944Sobrien
4398944Sobrien/* Attempts to parse CMD returning a ``struct mi_command''.  If CMD is
4498944Sobrien   invalid, an error mesage is reported (MI format) and NULL is
4598944Sobrien   returned. For a CLI_COMMAND, COMMAND, TOKEN and OP are initialized.
4698944Sobrien   For an MI_COMMAND COMMAND, TOKEN, ARGS and OP are
4798944Sobrien   initialized. Un-initialized fields are zero. */
4898944Sobrien
4998944Sobrienextern struct mi_parse *mi_parse (char *cmd);
5098944Sobrien
5198944Sobrien/* Free a command returned by mi_parse_command. */
5298944Sobrien
5398944Sobrienextern void mi_parse_free (struct mi_parse *cmd);
5498944Sobrien
5598944Sobrien#endif
56