~darkmuggle-deactivatedaccount/ubuntu/quantal/grub2/fix-872244

« back to all changes in this revision

Viewing changes to include/grub/parser.h

  • Committer: Bazaar Package Importer
  • Author(s): Otavio Salvador
  • Date: 2006-01-05 15:20:40 UTC
  • mto: (17.3.1 squeeze) (1.9.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20060105152040-b72i5pq1a82z22yi
Tags: upstream-1.92
ImportĀ upstreamĀ versionĀ 1.92

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* parser.h - prototypes for the command line parser.  */
 
2
/*
 
3
 *  GRUB  --  GRand Unified Bootloader
 
4
 *  Copyright (C) 2005  Free Software Foundation, Inc.
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; either version 2 of the License, or
 
9
 *  (at your option) any later version.
 
10
 *
 
11
 *  This program is distributed in the hope that it will be useful,
 
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *  GNU General Public License for more details.
 
15
 *
 
16
 *  You should have received a copy of the GNU General Public License
 
17
 *  along with this program; if not, write to the Free Software
 
18
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
19
 */
 
20
 
 
21
#ifndef GRUB_PARSER_HEADER
 
22
#define GRUB_PARSER_HEADER      1
 
23
 
 
24
#include <grub/types.h>
 
25
#include <grub/err.h>
 
26
 
 
27
/* All the states for the command line.  */
 
28
typedef enum
 
29
  {
 
30
    GRUB_PARSER_STATE_TEXT = 1,
 
31
    GRUB_PARSER_STATE_ESC,
 
32
    GRUB_PARSER_STATE_QUOTE,
 
33
    GRUB_PARSER_STATE_DQUOTE,
 
34
    GRUB_PARSER_STATE_VAR,
 
35
    GRUB_PARSER_STATE_VARNAME,
 
36
    GRUB_PARSER_STATE_VARNAME2,
 
37
    GRUB_PARSER_STATE_QVAR,
 
38
    GRUB_PARSER_STATE_QVARNAME,
 
39
    GRUB_PARSER_STATE_QVARNAME2
 
40
  } grub_parser_state_t;
 
41
 
 
42
/* A single state transition.  */
 
43
struct grub_parser_state_transition
 
44
{
 
45
  /* The state that is looked up.  */
 
46
  grub_parser_state_t from_state;
 
47
 
 
48
  /* The next state, determined by FROM_STATE and INPUT.  */
 
49
  grub_parser_state_t to_state;
 
50
 
 
51
  /* The input that will determine the next state from FROM_STATE.  */
 
52
  char input;
 
53
 
 
54
  /* If set to 1, the input is valid and should be used.  */
 
55
  int keep_value;
 
56
};
 
57
 
 
58
/* Determines the state following STATE, determined by C.  */
 
59
grub_parser_state_t
 
60
EXPORT_FUNC (grub_parser_cmdline_state) (grub_parser_state_t state,
 
61
                                         char c, char *result);
 
62
 
 
63
grub_err_t
 
64
EXPORT_FUNC (grub_parser_split_cmdline) (const char *cmdline,
 
65
                                         grub_err_t (*getline) (char **),
 
66
                                         int *argc, char ***argv);
 
67
 
 
68
#endif /* ! GRUB_PARSER_HEADER */