Fix cross compilation (e.g. on Darwin). Following changes to make.tmpl,
[AROS.git] / arch / all-pc / boot / grub2-aros / include / grub / parser.h
blob64f9f5cc20faf6c56c914fe72db60e576ffc713f
1 /* parser.h - prototypes for the command line parser. */
2 /*
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2005,2007,2009 Free Software Foundation, Inc.
6 * GRUB 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 3 of the License, or
9 * (at your option) any later version.
11 * GRUB 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.
16 * You should have received a copy of the GNU General Public License
17 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef GRUB_PARSER_HEADER
21 #define GRUB_PARSER_HEADER 1
23 #include <grub/types.h>
24 #include <grub/err.h>
25 #include <grub/reader.h>
27 /* All the states for the command line. */
28 typedef enum
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;
42 /* A single state transition. */
43 struct grub_parser_state_transition
45 /* The state that is looked up. */
46 grub_parser_state_t from_state;
48 /* The next state, determined by FROM_STATE and INPUT. */
49 grub_parser_state_t to_state;
51 /* The input that will determine the next state from FROM_STATE. */
52 char input;
54 /* If set to 1, the input is valid and should be used. */
55 int keep_value;
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);
63 grub_err_t
64 EXPORT_FUNC (grub_parser_split_cmdline) (const char *cmdline,
65 grub_reader_getline_t getline_func,
66 void *getline_func_data,
67 int *argc, char ***argv);
69 struct grub_parser
71 /* The next parser. */
72 struct grub_parser *next;
74 /* The parser name. */
75 const char *name;
77 /* Initialize the parser. */
78 grub_err_t (*init) (void);
80 /* Clean up the parser. */
81 grub_err_t (*fini) (void);
83 grub_err_t (*parse_line) (char *line,
84 grub_reader_getline_t getline_func,
85 void *getline_func_data);
87 typedef struct grub_parser *grub_parser_t;
89 grub_err_t grub_parser_execute (char *source);
91 grub_err_t
92 grub_rescue_parse_line (char *line,
93 grub_reader_getline_t getline_func,
94 void *getline_func_data);
96 #endif /* ! GRUB_PARSER_HEADER */